Emacs: Insert Alphabets A to Z

By Xah Lee. Date: . Last updated: .

Here's a command that inserts letters a to z, each on a line by itself.

(defun xah-insert-alphabets-az (&optional @use-uppercase-p)
  "Insert letters a to z vertically.
If `universal-argument' is called first, use CAPITAL letters.

URL `http://ergoemacs.org/emacs/emacs_insert-alphabets.html'
Version 2015-11-06"
  (interactive "P")
  (let (($startChar (if @use-uppercase-p 65 97 )))
    (dotimes ($i 26)
      (insert (format "%c\n" (+ $startChar $i))))))

Sample output:

a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z

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
  dragon
  phoenix
  elf
  hydra
  medusa
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. Emacs: Edit Column Text, Rectangle Commands
  2. Emacs: Insert Alphabets A to Z
  3. Emacs: Copy Rectangle Region to kill-ring
  4. Emacs: Align Text
  5. Emacs: picture-mode, ASCII Diagram
  6. Emacs: Make Whitespaces Visible
Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Ask me question on patreon