Table of Contents

Next: , Previous: Sparse trees, Up: Document Structure


2.7 Plain lists

Within an entry of the outline tree, hand-formatted lists can provide additional structure. They also provide a way to create lists of checkboxes (see Checkboxes). Org supports editing such lists, and the HTML exporter (see Exporting) parses and formats them.

Org knows ordered lists, unordered lists, and description lists.

Items belonging to the same list must have the same indentation on the first line. In particular, if an ordered list reaches number ‘10.’, then the 2–digit numbers must be written left-aligned with the other numbers in the list. Indentation also determines the end of a list item. It ends before the next line that is indented like the bullet/number, or less. Empty lines are part of the previous item, so you can have several paragraphs in one item. If you would like an empty line to terminate all currently open plain lists, configure the variable org-empty-line-terminates-plain-lists. Here is an example:

     ** Lord of the Rings
        My favorite scenes are (in this order)
        1. The attack of the Rohirrim
        2. Eowyn's fight with the witch king
           + this was already my favorite scene in the book
           + I really like Miranda Otto.
        3. Peter Jackson being shot by Legolas
            - on DVD only
           He makes a really funny face when it happens.
        But in the end, no individual scenes matter but the film as a whole.
        Important actors in this film are:
        - Elijah Wood :: He plays Frodo
        - Sean Austin :: He plays Sam, Frodo's friend.  I still remember
          him very well from his role as Mikey Walsh in The Goonies.

Org supports these lists by tuning filling and wrapping commands to deal with them correctly2, and by exporting them properly (see Exporting). Since indentation is what governs the structure of these lists, many structural constructs like #+BEGIN_... blocks can be indented to signal that they should be part of a list item.

If you find that using a different bullet for a sub-list (than that used for the current list-level) improves readability, customize the variable org-list-demote-modify-bullet.

The following commands act on items when the cursor is in the first line of an item (the line with the bullet or number).

<TAB>
Items can be folded just like headline levels. Normally this works only if the cursor is on a plain list item. For more details, see the variable org-cycle-include-plain-lists. to integrate, plain list items will be treated like low-level. The level of an item is then given by the indentation of the bullet/number. Items are always subordinate to real headlines, however; the hierarchies remain completely separated.

If org-cycle-include-plain-lists has not been set, <TAB> fixes the indentation of the current line in a heuristic way.

M-<RET>
Insert new item at current level. With a prefix argument, force a new heading (see Structure editing). If this command is used in the middle of a line, the line is split and the rest of the line becomes the new item3. If this command is executed in the whitespace before a bullet or number, the new item is created before the current item. If the command is executed in the white space before the text that is part of an item but does not contain the bullet, a bullet is added to the current line.
M-S-<RET>
Insert a new item with a checkbox (see Checkboxes).
<TAB> in new, empty item
In a new item with no text yet, the first <TAB> demotes the item to become a child of the previous one. The next <TAB> makes it a parent, and so on, all the way to the left margin. Yet another <TAB>, and you are back to the initial level.
S-<up>
S-<down>
Jump to the previous/next item in the current list, but only if org-support-shift-select is off. If not, you can still use paragraph jumping commands like C-<up> and C-<down> to quite similar effect.
M-S-<up>
M-S-<down>
Move the item including subitems up/down (swap with previous/next item of same indentation). If the list is ordered, renumbering is automatic.
M-<left>
M-<right>
Decrease/increase the indentation of an item, leaving children alone.
M-S-<left>
M-S-<right>
Decrease/increase the indentation of the item, including subitems. Initially, the item tree is selected based on current indentation. When these commands are executed several times in direct succession, the initially selected region is used, even if the new indentation would imply a different hierarchy. To use the new hierarchy, break the command chain with a cursor motion or so.
C-c C-c
If there is a checkbox (see Checkboxes) in the item line, toggle the state of the checkbox. If not, this command makes sure that all the items on this list level use the same bullet. Furthermore, if this is an ordered list, make sure the numbering is OK.
C-c -
Cycle the entire list level through the different itemize/enumerate bullets (‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’). With a numeric prefix argument N, select the Nth bullet from this list. If there is an active region when calling this, all lines will be converted to list items. If the first line already was a list item, any item markers will be removed from the list. Finally, even without an active region, a normal line will be converted into a list item.
C-c *
Turn a plain list item into a headline (so that it becomes a subheading at its location). See Structure editing, for a detailed explanation.
S-<left>/<right>
This command also cycles bullet styles when the cursor in on the bullet or anywhere in an item line, details depending on org-support-shift-select.
C-c ^
Sort the plain list. You will be prompted for the sorting method: numerically, alphabetically, by time, or by custom function.

Footnotes

[1] When using ‘*’ as a bullet, lines must be indented or they will be seen as top-level headlines. Also, when you are hiding leading stars to get a clean outline view, plain list items starting with a star are visually indistinguishable from true headlines. In short: even though ‘*’ is supported, it may be better to not use it for plain list items.

[2] Org only changes the filling settings for Emacs. For XEmacs, you should use Kyle E. Jones' filladapt.el. To turn this on, put into .emacs: (require 'filladapt)

[3] If you do not want the line to be split, customize the variable org-M-RET-may-split-line.