When coding in Emacs, I needed to insert an increasing sequence of integers as follows.
-
pdriver_object->MajorFunction[0] = NULL;
-
pdriver_object->MajorFunction[1] = NULL;
-
pdriver_object->MajorFunction[2] = NULL;
-
pdriver_object->MajorFunction[3] = NULL;
-
pdriver_object->MajorFunction[4] = NULL;
-
pdriver_object->MajorFunction[5] = NULL;
-
…
It’s easy to copy and paste the lines. Inserting a sequence of integers was the problem and I wrote a small Emacs Lisp code for that.
-
(defun f (n)
-
(let ((ns (number-to-string n)))
-
(if (<= n 30)
-
(progn
-
(insert ns)
-
(next-line)
-
(backward-char (length ns))
-
(f (1+ n))))))
-
(f 30)
This was my first practical elisp code. It required more time than typing in numbers, it’s very satisfactory. :)

