This is the example org-mode file used for the Denver Emacs org-mode introduction talk. Everything in this talk should work without any custom settings or installation with a reasonably recent Emacs version.
Let’s start with a headline, this is kind of like Markdown’s # character:
Text can be put into the headline. You can create another headline at the same level with another * character
Nesting headlines is as easy as adding another start
You can really go as deep as you want. This is the general building block for org-mode navigation.
Next, let’s talk about some markup
equal signs are verbatim text
tildes can also be used
You can generate lists with the -
character (seen above), or create numbered
ones:
You can hide the contents of a headline by putting the point (cursor) or it and
hitting TAB
.
You can also toggle hiding and showing of all headlines with SHIFT-TAB
.
Auto expanding tables are one of the coolest features of org-mode, because
tables in Markdown just plain suck. In order to create a new table, you can
start typing it manually, or press C-c |
, which will prompt for the table’s
dimensions.
First Name | Last Name | Years using Emacs |
---|---|---|
Lee | Hinman | 5 |
Mike | Hunsinger | 2 |
Daniel | Glauser | 4 |
Really-long-first-name-guy | long-last-name-pers | 1 |
In an org-mode file, you can press C-c l
to store a pointer to wherever you
are in the file. Then, with (or without) text highlighted hit C-C C-l
to make
it into a link.
[BROKEN LINK: No match for fuzzy expression: Hello]
If you don’t want to store a pointer (ie, link to a website or something), you
can just hit C-c C-l
and type or paste the link. To manually create a link, do
something like:
(ignore the *SRC blocks for now, we’ll get there)
[[http://google.com/][Google]]
You can link to files, images, websites, emails, irc, and all kinds of things.
One of the most common uses for org-mode is a sort of “task list” or TODO list. Org-mode supports this by allowing markers in the headline for the state of a task. Let’s look at an example:
[ ]
sub task one[X]
sub task two[ ]
sub task three
You can toggle each task in a list with the C-c C-c
keyboard shortcut.
You can change the status of a task by hitting C-c t
in the body of a task
anywhere, which will prompt for the state to put it in.
You can create as many of these as you’d like, for example (from my own config, use what works best for you, configuring them is a little out of scope right here) here’s what I use:
A lot of people just use “TODO” and “DONE” though.
You can add tags by putting them surrounded in “:” in the headline. Additionally, priorities
Tags are just another way of organizing things.
Again you can configure these, or just use the 3 built in ones.
[1/3]
Task with sub headlinesSo TODOs are all well and good, but what is a really neat feature is when you can easily capture new TODOs and display them easily.
In order to do this, let’s configure a couple of Emacs options in your emacs init:
(require 'org) ;; Setup C-c c to capture new TODOs (global-set-key (kbd "C-c c") 'org-capture) ;; Setup a key bind for the agenda (global-set-key (kbd "C-c a") 'org-agenda) ;; Set up agenda to know about our file, you can use a list of files or ;; directories here (setq org-agenda-files '("~/todo.org")) ;; A new template (setq org-capture-templates '(("t" "Todo" entry (file "~/todo.org") "* TODO %?\n%U\n")))
Now, hit C-c c
to bring up the capture template list, then t
to capture a
new TODO item.
Once you’ve captured a few TODOs, you can try out the agenda by hitting C-c a
,
which will prompt for what agenda you’d like to see, for now hit t
to see the
TODO list agenda.
Org has a lot of export options, they are all contained behind a C-c C-e
export backend, exporting to HTML, markdown, plain text, pdf, etc.
Maybe not in excruciating detail, but we can show off the power and cover it in more detail at a later time:
org-refile
)\(a + b\)
(defun my/function () "docstring" (interactive) (progn (+ 1 1) (message "Hi")))
echo $data > /tmp/foo for i in `cat /tmp/foo`; do echo $i done
echo "hi"
# do some things echo "stuff" echo "more stuff" echo <<hi>>
To enter and edit a block of text, use C-c C-'