Emacs: Insert A to Z Vertically πŸš€

By Xah Lee. Date: . Last updated: .

Here's a command that inserts letters a to z, vertically in a column. (similar to rectangle-number-lines) It can also insert any sequence of Unicode characters.

(defun xah-insert-column-az ()
  "Insert letters A to Z vertically, similar to `rectangle-number-lines'.
The commpand will prompt for a start char, and number of chars to insert.
The start char can be any char in Unicode.
URL `http://xahlee.info/emacs/emacs/emacs_insert-alphabets.html'
Version 2019-03-07"
  (let (
        ($startChar (string-to-char (read-string "Start char: " "a")))
        ($howmany (string-to-number (read-string "How many: " "26")))
        ($colpos (- (point) (line-beginning-position))))
    (dotimes ($i $howmany )
        (insert-char (+ $i $startChar))
        (forward-char $colpos)))))

To insert column of numbers, Alt + x rectangle-number-lines. [see Emacs: Edit Column Text, Rectangle Commands]

Insert A to Z Using rectangle-number-lines

Here's how to insert A to Z using emacs builtin command.

You can also insert letters A to Z by using rectangle-number-lines.

try change this

1 cat
2 creatures
3 dog
4 bird

to this

1 cat
2 creatures
  A. dragon
  B. phoenix
  C. elf
  D. hydra
  E. medusa
3 dog
4 bird
  1. Move cursor to before β€œdragon”.
  2. set-mark-command 【Ctrl + Space】.
  3. Move cursor to before β€œmedusa”.
  4. universal-argument 【Ctrl + u】.
  5. Now, Alt + x rectangle-number-lines. It will prompt you to enter arguments.
  6. Type 65 (Letter A has Unicode codepoint 65. a is 97). [see ASCII Characters]
  7. Remove the default %2d , type %c. (the β€œ%c” is for character format)

Emacs: Comment, Uncomment, Prefix Lines, Rectangle Edit