Using the built-in cl-lib package, you can write the following:
(cl-decf (nth 1 x))
Alternatively, in vanilla Elisp:
(setf (nth 1 x) (1- (nth 1 x)))
Be careful, though, to avoid modifying quoted constant lists such as '(3 6) in-place, as doing so modifies the constant globally and may cause the code to behave ...
Linum mode provides the linum-format customizable variable that allows you to format how you want your line numbers to appear. Set this variable to have the value "%x" to get hexadecimal line numbers. This can be done either through the built-in customization process or by running (setq linum-format "%x").
Edit: You may only want to have ...
I did some searching and surprisingly couldn't find any existing minor modes that seemed to do this. I thought it would be a fun little project, however, so I've written a minimal minor mode (rainbow-numbers-mode) that does this and included it below.
As it turns out, the only reasonable way to programmatically set text properties for something like this is ...
You can use org-number-to-letter from org-table.el (requires at least Emacs 26.1 or Org 9.1.9?)
;; => "Z"
;; => "AZ"
And type C-M-% (query-replace-regexp) with
[0-9]+ → \,(org-number-to-letters \#&)
If you need to do the search-and-replace from Lisp, use re-search-...
104 would be cz I think.
Using org mode eval setup:-- I suspect there are better choices fr functions but I'm an elisp learner.
These conversions might be more appropriates in your code in that there's less if/thens based on ranges.
(setq c 104)
(setq lsc (char-to-string (+ (% (- c 1) 26) (string-to-char "a"))))
(setq msc (...
I have solved my problem using vectors. I have written two functions:
convert-letter-to-digit: it takes a letter as argument and give a numnber as output;
authors-letters-to-digits: call convert-letter-to-digit and replace letters with corresponding numbers.
To write convert-letter-to-digit I was inspiered to vectors in C language, so I have defined a ...
Just tinkering, you can use car and cdr too. I'm sure someone will comment on whether this is good or bad.
(let ((v 99) (p 3) (l (list 1 2 3 4)))
(setcar (nthcdr p l) (+ (car (nthcdr p l)) v))
;; => (1 2 3 103)
You need to format your numbers with the leading zeros if you want them:
(format "%03d" 3)
When you type
(defvar foo '(00 01 02))
and evaluate it, Emacs reads the string "01" and recognizes it as a
number (integer) and stores it in the list. Then it promptly forgets
how the number was represented - as "1" or "01" or "000001".