--- title: A life of TODOs date: 2015-03-15 layout: post category: log --- It's been a year and seven months since I reintegrated Emacs to my life. I do most of my daily tasks with Emacs. From reading my favorite mailing lists with [[http://www.gnus.org/about.html][Gnus]], to replying to my work's [[https://github.com/baohaojun/org-jira][bug-tracker issues]]. I do all of it inside of Emacs, well, almost all of it, [[http://www.gnu.org/software/emacs/manual/html_node/emacs/EWW.html][EWW]] is only good for browsing documentation.. It came by surprise to me, but the data of my =TODO= says, that the major mode that drove me into the Emacs ecosystem, is [[http://orgmode.org/][Org-mode]]. *** Decomposing Org-mode So what is *Org-mode*? That's usually the main question from the newcomers. At first, *Org*, short for Org-mode, looks like another markup language. To others, it's the way to export to multiple document formats from Emacs. To the ones that read the [[http://orgmode.org/manual/index.html][Org-mode manual]] or [[https://www.gnu.org/software/emacs/manual/html_node/org/index.html][Emacs info reader]], it's just a =TODO= list and Agenda suite that mimics other software that they know of, for example, Evernote and Trello. Org is that and more. To quote the Org-mode website: #+begin_quote Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system. #+end_quote *** Everything is a TODO Org-mode revolves around plain text headings, which makes all of the entries generated by it manageable and portable. In Org-mode, all of the headings start with a =*=, followed by the state of the heading. The state usually changes from =TODO= to =NEXT=, and ends in =DONE=. For example: #+begin_src org ,* TODO Example to do This is a paragraph inside of the heading. [[http://example.com][this is a link to example]] ,* NEXT Next example to do ** Child heading with list - Item A - Item B - Item C ,* DONE Example done #+end_src This examples show the markup language that Org-mode uses. There's a full list of the elements in the [[http://orgmode.org/manual/Markup.html#Markup][markup section of the manual]]. *** But why TODOs? The brilliance behind the selection of =TODO= headings, is based on the fact that everything you write to be addressed later is a task to be done soon. To give an example of this, if I recommended you the works of Op-art artist [[http://en.wikipedia.org/wiki/Victor_Vasarely][Victor Vasarely]] in the middle of a party or an event conversation, one usually doesn't interrupt the conversation, and goes searching for Victor Vasarely's artwork in his smart-phone. Usually, what people do is to create a =TODO= in whichever format and in whatever software. For example: #+begin_example Artists to checkout: - Victor Vasarely <- Recommended by Carlos #+end_example As you can see, this basic note of the task is enough, but the problem arises if you were to sort it and search for this =TODO= later. This can be solved by having a markup or syntax with parseable definitions. Now what would that =TODO= look in Org-mode: #+begin_src org ,* Personal ,** Arts ,*** Victor Vasarely :LOGBOOK: CLOCK: [2015-03-15 Sun 23:34]--[2015-03-16 Mon 00:30] => 0:56 :END: [2015-03-15 Sun 23:33] #+end_src In the example above, there's a =TODO= entry in the correct tree (category), this way we can sort and order for fast searching. It seems like an overkill, but trust me, after a couple of =TODO=, you forget why you added that =TODO= and what to do =NEXT= with it. The example above shows a timestamp and clock to track the time spent on that =TODO=. This is useful for keeping track of the type of [[http://orgmode.org/manual/Tracking-your-habits.html#Tracking-your-habits][habits]] you commit. *** Outline structure with TODOs Giving the nature of Org-mode, you can outline a text with different heading levels. With this you can create sections, a hierarchy of topics, or a simple tree that works as the main outline of a text file. For instance, this text's outline so far: #+begin_src org ,* A life of TODOs ,** Decomposing Org-Mode ,** Everything is a TODO ,** Outline structure ,** Agenda made of TODOs #+end_src With these you can create projects or topics based on the headings levels. So it becomes fairly easy to order your ideas, and author documents. Org-mode well defined markup can be exported to any format. Org-mode can export to most common markups and documents, see the [[http://orgmode.org/manual/Exporting.html#Exporting][Exporting]] section of the Org-mode manual for more information. This document is rendered to HTML from Org markup, thanks to =jekyll= and [[https://github.com/wallyqs/org-ruby][org-ruby]]. *** Agenda made of TODOs With hierarchy and levels of your tasks, it makes sense to prioritize headings based on their schedule, deadline, and priority. That's when the [[http://orgmode.org/manual/Agenda-Views.html#Agenda-Views][Org-mode Agenda]] comes in the picture. #+CAPTION: Org-mode Agenda view #+NAME: block-agenda-nonproject.png [[../img/block-agenda-nonproject.png]] Agenda views render and display the current projects you have, the child headings of the projects, in these case the =NEXT= headings entries. The Agenda divides work into what is active, stuck, and scheduled. At the top of the Agenda, you have the headings with [[http://orgmode.org/manual/Deadlines-and-scheduling.html#Deadlines-and-scheduling][DEADLINES and SCHEDULED tags]]. Timestamps and Clocks help with your habits, but they can be used as a way to schedule tasks that need to be repeated or have a higher priority. For example, a =TODO= about doing your laundry weekly: #+begin_src org ,* TODO [#B] Laundry :CLEANING: :LOGBOOK: - State "DONE" from "TODO" [2015-02-23 Mon 13:01] - State "DONE" from "NEXT" [2015-01-16 Fri 18:54] CLOCK: [2015-01-10 Sat 12:17]--[2015-01-10 Sat 12:18] => 0:01 :END: :PROPERTIES: :LAST_REPEAT: [2015-02-23 Mon 13:01] :END: :DEADLINE: <2015-03-01 Sun +1w> [2015-01-10 Sat 12:17] #+end_src The above =TODO= entry has a priority of level B, and will be repeated every week after it's set to the =DONE= state, that's what the tag =:DEADLINE:= says. The last time this entry was re-inserted was on Monday February 23, this was introduced after the state was set to =DONE=. The =:LOGBOOK:= tells us when was the last time the state was changed from "=TODO=" to "=DONE=", and also a clock of the time it took for this =TODO= to be captured. The last timestamp tells us the time this =TODO= was captured(inserted), which was on Saturday January the 10th. *** Capture quickly, take care of it later Like mentioned before, you usually want to capture a =TODO=, and add as much information as you can in a give set of time. This means that you should write down as fast as possible the task you have in mind or the information just given. This a great habit and it works for anybody, since not all retain that much information, at least, not me. Because we want to capture as soon as you think about the =TODO=, captures occur directly from any mode or place in ~Emacs~. Capturing is done by calling =org-capture=, this will bring a selection frame that will give you hooks based on a set of templates in your configuration. For instance: #+CAPTION: Org-mode Capture selection #+NAME: org-capture.png [[../img/org-capture.png]] For example, you just realized that you have to reply to a collaborator or compose an email. You want to capture as fast as possible this =TODO=, you make use of the email template in =org-capture= by pressing =m=. This will give you a template to fill out, in these case the email address and the name. To generate new capture templates you can call =C-c c C=, this will bring up a customize group frame. For more information on the templates, check the Org-mode manual section on [[http://orgmode.org/manual/Capture-templates.html][Capture Templates]]. To understand how capturing a =TODO= works, read the Org-mode manual section on [[http://orgmode.org/manual/Capture-_002d-Refile-_002d-Archive.html#Capture-_002d-Refile-_002d-Archive][Capturing, Refiling and Archiving]]. *** Refile and archive later This is one of my least favorite parts, but in order to keep a sane =TODO= entries tree and to keep tidy projects, you have to refile them and archive them. Refile, literally, means reorganize and file the entries in their corresponding hierarchy. For example, move your recently captured =TODO= entry about Cats into Personal/Animals. #+begin_src org ,* Cats ,* Personal ,** Animals #+end_src You can refile any heading in any view of Org-mode with =C-c C-w=, that calls =org-refile=, and that will ask you in what hierarchy or project do you want to file a =TODO= heading. org-refile takes care about assigning a hierarchy to the entry, for instance, the Cats =TODO= entry it was first heading, it will now be filed under Personal/Animals/, turning into a third hierarchy heading. For example: #+begin_src org ,* Personal ,** Animals ,*** Cats #+end_src You should capture and refile all the uncatalogued =TODO= entries into a file dedicated as a staging step before refiling each to the correct project. Usually, the community makes use of the '=refile.org=' file as a staging space, and it's turn into a community standard. The *advice* is to ~refile when you have time~, make it your last errand, the same goes for archiving. Org-mode Agenda views will tell you what entries are ready to be archived. ** TODOs make my life easier Org-mode is part of my work flow with Emacs, and I love it. On a daily basis, I create =TODO= entries for every task or activity I take part of, for instance, keeping track of meetings, email replies to write, mailing list articles to reply, documentation to finish. This is all thanks to how well Org-mode is integrated with Emacs base modes, like [[http://www.gnus.org/about.html][Gnus]] and [[http://magit.github.io/][Magit]]. All kind of modes provide integration with Org-mode, at least [[http://orgmode.org/manual/External-links.html][org-links]], for example, =org-mu4e=, that provides org-links to mails and drafts to later to be finished or to be later send. According to what I've witness and what I've found online, it looks like I don't even take full advantage of Org-mode. You can find hardcore users and org-veterans in the Org-mode mailing list - [[http://news.gmane.org/gmane.emacs.orgmode][http://news.gmane.org/gmane.emacs.orgmode]]. One of those hardcore users is Bernt Hansen. To see how Bernt Hansen makes use of Org-mode and his work flow, go read his famous article [[http://doc.norang.ca/org-mode.html][Organize your life in Text]]. Thanks to [[http://orgmode.org/manual/MobileOrg.html#MobileOrg][MobileOrg]], you can capture =TODO= entries from your Smart-phone. I capture =TODO= entries everywhere, that I later synchronize with the ones in my laptop. I hope that with the given points of how you can make use of Org-mode, and how I make use of it, I'm able to explain why Org-mode is the killer feature of Emacs.