Short Tutorial on how to use org-mode for notes, todos, and reminders
Org-Mode can be a deep dive, even for experienced emacs users. This tutorial will give you a quick tour of just a few of its features: taking notes, tracking todos, and using the agenda to organize your days and weeks.
There’s lots to explore, so let’s get started!
Before we do anything else, let’s make sure auto-fill-mode
comes on
automatically when we’re editing org files. It’s basically the same as
turning on “Soft wrap” when creating a new gist.
Add this to your init.el
file (usually found in a directory like
~/.emacs.d
):
(add-hook 'org-mode-hook 'turn-on-auto-fill)
Then quit and restart emacs.
The easiest way to get started using org-mode is for taking notes.
Open a new org buffer: emacs tutorial.org
This is going to be a daily journal. A record of things done, things to do, and things we can yet only dream of.
Let’s give the doc a header. A title, a declaration of purpose. Make it the month and the year, so we know what we’re looking at when we come back:
* May 2021
Well done! It’s not much, but it’s the start of great things.
Let’s make some sub-headings under there, for the days of the month:
* May 2021 ** 3 May ** 4 May ** 5 May ** 6 May ** 7 May
More interesting, by far. And now we’ve unlocked the first of org-mode’s many powers: nesting.
Scroll back up to the first line, and hit <tab>
.
Whoa! Where’d the other headings go?
Hit <tab>
again. The top-level heading unfolds, revealing the
subheadings again.
org-mode carries this principle – where sub-items are nested inside higher-level ones, and can be revealed and hidden at will – all the way down, through headings, notes, etc.
Speaking of notes, let’s add some:
* May 2021 ** 3 May *** grocery-store run - need to pick up: + eggs + oat milk + cinnamon + loaf of bread (thick slices) + sugar - don't forget your mask! *** weekly council of ricks meeting - rick037 is loose again - rick048 thinks we should just let him go + i disagree + also rick048 has a mullet so we should ignore him - jerry077 got swapped with jerry099 at the last iteration of jerry's day-care romp, neither rick is admitting responsibility ** 4 May ** 5 May ** 6 May ** 7 May
Ok! Now we’ve got a list of groceries to pick up, and some meeting
notes. Play around with the nesting of the various elements, both by
hitting <tab>
at various points to see what’s revealed/hidden, and
changing the indention levels of the text. Notice which things
org-mode cares about, and which it ignores?
Congratulations! You’ve already mastered the art of taking notes in org-mode. Well done!
You’ve already seen a few links in this tutorial. Adding a new one is easy (and very much like adding one in Markdown).
Let’s add a new note entry linking to this repo:
- Notes about the org-mode tutorial: + repo [[https://github.com/mindbat/getting-started-with-org-mode][here]] + the text of the tutorial /is/ a tutorial! mindblown.gif
Nice! Note how org-mode swaps out displaying the link and the text for just the (now-underlined) text.
But there’s a typo in our link. How do we fix it?
With your cursor over the link text, hit C-c C-l
. A mini-buffer will
open up at the bottom of emacs, letting you fix the link (and edit the
text, too, if you’d like).
All fixed? Good, now hit C-c C-o
with your cursor on the text to
open the link in your default browser. Pretty neat, huh?
Any heading can become a TODO. Let’s add a reminder to do the laundry:
* May 2021 ** 5 May *** TODO wash dirty clothes
Once the chore is done, you can mark it complete by setting your
cursor anywhere on the TODO line, and hitting C-c C-t
.
You can add lists under todos like anything else, in case you need notes about the item:
* May 2021 ** 5 May *** TODO wash dirty clothes - don't forget the laundry hamper in the downstairs closet! - but don't wash the new shirts, those are dry-clean only!
These obey the same show/hide rules as everything else. Try it out!
Okay, fine. It’s not enough to scroll through and find your todos. Sometimes we need to see them all at once.
Before we can do that, though, we’ll need to tell emacs (and thus org-mode) where to find our Todos, so it can add them to the (drumroll please) Agenda.
Add the following code to your emacs init.el
file:
(setq org-agenda-files (append (directory-files-recursively "~/getting-started-org-mode" "org$")))
(Note: The above assumes you’re adding your tutorial org-files to your copy of this repo. If that’s not the case, you’ll need to update the path there to point to where you are keeping your org files)
Restart emacs. With your tutorial.org
buffer open again, hit: M-x
org-agenda
, then press t
. You should see a list of all your todos,
across all the org files in this directory. Go ahead, try adding a new
org file, putting a todo in it, and then refreshing the agenda buffer
(hint: C-x b
to switch back to the buffer, then g
to refresh the list)
“That’s all fine, Mr Mindbat, but what if I need to set a deadline for a todo? You know, something to remind me that I absolutely have to get it done by X date?”
Well, you’re in luck! Because adding a deadline, and seeing a list of upcoming todos, is just as easy!
Add a new Todo to your growing list:
* May 2021 ** 6 May *** TODO buy tickets for summer vacation
That’ll definitely have a deadline, right? We need to buy the tickets before (long before) we can go on the trip!
So let’s add a deadline! With your cursor on the Todo line, hit C-c
C-d
. You’ll see another mini-buffer pop-up, this time with a date
auto-populated (it should be your current date) and a calendar
displayed above. Enter the date you want for the deadline in the
mini-buffer (note the format!), and when you hit enter, you should see
something like this:
* May 2021 ** 6 May *** TODO buy tickets for summer vacation DEADLINE: <2021-06-05 Sat>
Anytime you want to edit the deadline, you can either do it
directly, or go back to the TODO line and hit C-c C-d
again to bring
up the calendar + mini-buffer.
Add a few more todos with deadlines, this time picking dates in the
next day or so. Then hit M-x org-agenda
followed by a
(not t
this time), and voila! A view of all your todos for the coming week!
All right! You’ve mastered note-taking, creating todos, and setting deadlines. You can view a weekly agenda based on those todos, and link out to external websites when needed.
But what about todos that repeat? Things like doing the laundry, which you (hopefully) do about once a week?
Sure, you could manually create a new TODO every week, with a deadline on the next day you have to have it done by.
But this is emacs! Why would we do anything manually?
Create a new, weekly todo:
* May 2021 ** 7 May *** TODO set trash cans out on street for pickup
Give it a deadline using the normal method. Then edit that line, adding a one week repeater. It should look something like this:
* May 2021 ** 7 May *** TODO set trash cans out on street for pickup DEADLINE: <2021-05-07 +1w>
Save the buffer, and refresh the weekly agenda. You see your todo in there just like normal, right?
Now mark it done, and refresh the agenda. Boom! Org-mode sees you’ve completed it for this week, and then automatically sets a new deadline one week into the future.
You can set repeaters for days (d
), weeks (w
), months (m
), even
years (y
)! Check out the manual for a full list of options.
You did it!
We’ve just scratched the surface of what org-mode can do. You can use it to give presentations, sync it with your Google Calendar, even build spreadsheets!
You’ll want to bookmark the Org-Mode Manual, and come back to it often to find a new feature to try out.