Formatting Tables

If you’re like me, you automatically think of the Org mode table editor (or Orgtbl minor mode) when you think of tables in Emacs. It’s hard to beat that functionality and Orgtbl mode makes it available everywhere in Emacs, even if you’re not in an Org buffer. Sometimes, though, you’d like to have special formatting for some or all of the table. That’s where delim-col comes in.

Delim-col is built-in Emacs functionality that allows you to do things like adjust what string separates the columns, add a beginning or ending string to each item, add an ending string for each row, and adjust the padding in the table. It can be really handy for copying and pasting and then reformatting tables from an external source.

I didn’t know about delim-col until I read about it over at Emacs Notes, where you’ll find a good explanation of the facility and what it can do. The Emacs Notes post also offers at bit of Elisp to make choosing the strings and delimiters a bit easier. By default you have to set them using a series of setq statements if you want something different from the built-in choices. The Emacs Notes codes arranges for you to be prompted for the values.

You probably won’t need the delim-col functionality very often but when you do it’s much easier than using something like a keyboard macro. Take a look at the post and see if you don’t agree.

This entry was posted in General and tagged . Bookmark the permalink.