Emacs as Word Processor: Org mode

Org mode is a markup language built with minimal resources around plain text, so it is as easy to adopt as markdown. In fact, Org mode is even easier because it does not have different implementations (flavours) that require a specific text editor where that particular flavour is fully implemented, as is the case with markdown. There is just one full-featured Org mode fully implemented in its single editor – Emacs.

Document outline

When you name a text document with the ending .org and have it open in Emacs, Emacs is automatically in Org mode. The most prominent feature of Org mode is document outline.

A common feature of structured text is the heading versus paragraph(s) that follow the heading. In Org mode, the heading is a line of text that begins with * . The heading is color-coded, thus Org mode provides syntax highlighting for basic prose.

The paragraphs that follow the heading are collapsible into the heading in Emacs, so that you see just the headings in your document when you need an overview. The collapse into headings and un-collapse works by Tab key, which calls the command org-cycle in Org mode.

So the Tab key fulfills the collapse function in headings in Org mode. When you open up Emacs and only the headings are visible in your org file, C-u C-u C-u Tab will expand everything (i.e. Tab preceded by thrice C-u).

If you are like me, you write your document by defining the headings first, i.e. the sub-topics that outline the plan of the document. After outlining the plan, it is easier to stay focused and productive by composing the detailed paragraphs under their respective headings.

Moving chunks of text around

Other Org-specific keybinds are M-up (that is, Alt-up arrow) and M-down (Alt-down arrow), which move chunks of text around. When the point is inside a paragraph, these keybinds transpose the paragraph with the next paragraph in the respective direction.

For your safety, moving paragraphs by keybind does not work across headings. That is, when you are in the first paragraph under a heading, M-up does not do anything. When you are in the last paragraph, M-down does not do anything.

However, when the point is in a heading, then Alt-up and Alt-down swap the headings along with the text paragraphs that belong to them. This is a convenient way to drag an entire chapter around while preserving the chapter’s internal structure.

Inline formatting

Inline italics, bold, and other similar formatting is recognised as follows:

*bold* 
/italic/ 
_underline_ 
+strikethrough+ 
=verbatim= 
~code~

Structure templates

Structure templates in Org are specific formatted paragraphs. Relevant for writers, they include blockquote, verse, and center-aligned paragraphs. A list of structure templates is invoked by org-insert-structure-template and the properly org-formatted result for e.g. a blockquote would look as follows:

#+begin_quote
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ultricies lacus sed turpis tincidunt id. A pellentesque sit amet porttitor. Leo vel fringilla est ullamcorper eget nulla facilisi etiam dignissim. Amet purus gravida quis blandit turpis. Tempor id eu nisl nunc mi ipsum faucibus vitae aliquet. Proin sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Sit amet dictum sit amet justo donec enim. Condimentum mattis pellentesque id nibh tortor. Sociis natoque penatibus et magnis dis parturient. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Sit amet mattis vulputate enim nulla. Ut tellus elementum sagittis vitae et leo duis ut. Risus pretium quam vulputate dignissim suspendisse. Lacus sed viverra tellus in. Tortor pretium viverra suspendisse potenti nullam ac tortor vitae.

Purus in mollis nunc sed id semper risus in. Aenean euismod elementum nisi quis eleifend quam adipiscing. In fermentum et sollicitudin ac orci phasellus. Est ante in nibh mauris cursus mattis molestie a iaculis. Tristique senectus et netus et malesuada fames. Arcu bibendum at varius vel pharetra vel turpis. Nunc lobortis mattis aliquam faucibus. At auctor urna nunc id cursus. Tellus molestie nunc non blandit massa enim. In egestas erat imperdiet sed euismod. Rhoncus dolor purus non enim praesent elementum. Lacus laoreet non curabitur gravida. Integer eget aliquet nibh praesent tristique magna sit. Sem nulla pharetra diam sit amet nisl suscipit. Blandit libero volutpat sed cras ornare arcu dui vivamus. Nisl nunc mi ipsum faucibus vitae. Vulputate eu scelerisque felis imperdiet proin fermentum leo vel.
#+end_quote

Insert comments or Comment out

The shortest way to insert a comment in Org mode file is to start a line with # . Unfortunately there appears to be no way to insert an inline comment in the middle of a paragraph.

For longer comment blocks there is an appropriate structure template:

+begin_comment
+end_comment

Also, an entire chapter (heading with all of its following text paragraphs) can be commented out by the command org-toggle-comment, bound to C-c ;.

Leave a Reply

Your email address will not be published. Required fields are marked *