Xah Lee, 2010-03-15, 2011-09-28
Emacs has a mode called outline-mode. A much improved version is called org-mode. This page shows you the basics of org-mode.
Sometimes you need to write some notes with a tree-structure. For example, headings, subsections, and content text. This is called outline format. You want to be able to view just the headings, or view all content of a section but hide the rest, etc.
In your file, any line that starts with a star followed by space * , is level 1 heading.
Any line starting with 2 stars ** is level 2 heading. Here's a example file.
* to do Remember to bring lunch box and 2 bananas. ** call mom don't forget to call mom ** do that * call Jane. her phone is 123-4567 * finish coding absca. john was not happy. ** give that tutorial to john. ** Dave wanted do lunch. He got some ideas. * learn emacs outline stuff texts can actually be free form.
The star character must be at the beginning of line, and must have a space after it.
Copy the above text in a file and save it. Now, open the file, type 【Alt+x org-mode】. Then, emacs will display it like this:
Once you have written a lots text in a outline tree structure, you usually want to add or edit your notes in a way not to destroy the existing tree structure. The following commands are good for it.
If you name your file ending in “.org”, emacs will open it in org-mode automatically.
You can also put this line as the first line of the file:
-*- mode: org -*-
Emacs will start org-mode when the file is opened.
If you want any file ending in “.txt” open in org-mode, you can add this line to your emacs init file:
(add-to-list 'auto-mode-alist '("\\.txt\\'" . org-mode))
org-mode is often used for todo notes too. org-mode has many features for todo. For example: deadlines, scheduling/agenda, priorities, keywords, …. Here are some basics in using org-mode for todo.
You can mark headings as a todo item. For org-mode to recognize a todo item, the word “TODO” (all caps) must happen as the first word in a heading. Like this:
** TODO call mom for bday.
org-mode has commands to help you change a heading to todo item. The TODO string might also be DONE. There are also commands to show only TODO headings.
Place your cursor on a heading, then:
<2010-07-31 Sat>.Type 【Ctrl+c Ctrl+v】 to view just todo headings.
Each heading may have keywords associated with it, called “tags”. For example, you can have items with tags such as {work, family, urgent, coding}, or any word you like.
The syntax for tag is any word between colon, like this: :something: or :this:that:. They are usually placed at end of the line. Like this:
** call mom for bday. :family:... * finish writing the org-mode tutorial. :emacs:work:
Tag name characters must be any alphabets A to z, or digits 0 to 9, or “_” and “@”. It cannot have spaces or hyphen.
Tags are inherited from parent nodes, in the sense that when you search for a tag, a heading with that tag will show but also all its children, even if the children's headings do not contain that tag.
When in org-mode, there's a menu 〖Org〗. Try it. I always forgot to use the menu. From the menu, you can learn the most useful commands and the key shortcuts. There's also the menu 〖Org▸Documentation〗 that lets you easily goto org-mode's info doc.
org-mode also has a big website with tutorials, FAQ, and lots other tips and discussion forum, wiki, also a Google Techtalk video where the author Carsten Dominik speaks about it. Its home page is at: orgmode.org.