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
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