Prev: Editing with Emacs, Up: (dir)

Understanding the key M-x

The first key sequence you need to learn for Emacs outlining is M-x, which can be either Esc,x or Alt+x.

  • Esc,x: Press the "Escape" key, release it, and then press the "X" key.
  • Alt+x: Hold the "Alt" key while pressing the "x" key.

This sequence is commonly abbreviated as M-x. In this guide, I'll stick to this shorthand for clarity.

Get started with simple outlining

To begin, create a new file in Emacs. Press Alt+x and you'll see M-x appear in the minibuffer. Type org-mode and hit return. The mode line will now display Org, indicating that you're in Org mode.

  1. Type a single asterisk * followed by a space at the start of a line.
  2. Write a heading and press return.
  3. Add some text under the heading.

Now, add another first-level heading by repeating the process. Press Tab on the first heading line, and the text beneath it will fold away. This is called "folding," and it allows you to navigate easily between your outline and the detailed text.

Extending your outline

To add a second-level heading, use two asterisks ** and a space. Type a heading and some text underneath. Fold it away by pressing Tab while your cursor is on the second-level heading. You can also fold the first-level heading above it, effectively nesting the second-level heading within the first.

More advanced actions

While on a first-level heading, explore the "Org" menu and select "Edit structure" followed by "Move subtree up." Your chosen heading will relocate to the top of your document, folded or unfolded.

Final thoughts

You've learned the basics of outlining in Emacs with just one key sequence: M-x. This versatile key sequence will serve you well as you dig deeper into Emacs functionalities.

Copyright (C) 2020-2023 by stormrider; All Rights Reserved