//
you're reading...
Emacs, HowTo

Numbered lists in Emacs


Imagine that you’re using Emacs and you have a list of items that you would like to convert into a numbered list.

We’re going from:

first

second

third

To:

1. first

2. second

3. third

Obviously, there are many ways to achieve this, but one is to use the Emacs Keyboard Macro Counter.

  • Put the cursor one line ABOVE your list.
  • Start a macro: `F3`
  • Insert the counter value: `C-x C-k C-i`. A 0 will appear
  • Insert the DOT and a space: `.`
  • Move ┬áthe cursor to the next line
  • Stop the macro: `F4`
  • Select your list
  • `M-x apply-macro-to-region-lines`
  • You can delete the 0 you added on the top and enjoy :)
About these ads

About Roberto Aloi

Software Engineer and Erlanger. Author of www.tryerlang.org.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: