Aligning text in emacs

Aligning text like a table is often a useful task. I use this workflow to make the text tidier. For instance when I have two columns of text of varying width, aligning them makes it easier to read.

Steps:
1) Select the region you would like to align (C-x h will select the entire buffer)
2) C-u M-x align

Thats it. The selected region would have been aligned based on the first line of the region.

Example:
Before:
what? who?
hello      world

After:
what? who?
hello world

By default only the space is used as a delimiter. If you would like to perform a little sophisticated alignment, you can make use of the align-regex function.
city, population
new york, 8.49M
san francisco, 0.85M


Comments

Popular posts from this blog

The mysterious ORA-03111 error

Note on allocationSize parameter of @SequenceGenerator while using JPA

xVM's vboxmanage.exe command