Emacs: Insert Alphabets A to Z

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://ergoemacs.org/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. Alt+x set-mark-commandCtrl+Space】.
  3. Move cursor to before “medusa”.
  4. Alt+x universal-argumentCtrl+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 Table]
  7. Remove the default %2d , type %c. (the “%c” is for character format)

Rectangle Edit Topic

  1. Edit Column Text, Rectangle Commands
  2. Insert Alphabets A to Z
  3. Copy Rectangle Region to kill-ring
  4. Align Text
  5. picture-mode, ASCII Diagram
  6. Make Whitespaces Visible

Elisp Command to Insert Things

  1. Insert Brackets by Pair
  2. Insert Letters A to Z
  3. Insert Random ID
  4. Insert Random UUID

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs


Emacs Lisp