Category Archives: org

On this page:

Capturing Notes with Remember

Ideas come from everywhere. While reading this blog, you might come across interesting snippets that you’d like to save. While writing code, you might be hit by an idea for something you want to do with the program. While on a phone call, you might need to write down what you need to prepare for a meeting the next day.

How do you take notes now? Do you jot your notes on a scrap of paper or into a leather notebook? Do you copy and paste what you’re looking at into a plain text file or document? Do you scribble things into a personal digital assistant?

I’ve tried different note-taking strategies: colorful mindmaps, outlined text files, even voice recordings. I felt frustrated every time I had to write down whose e-mail or which webpage prompted the note (shouldn’t the computer do that automatically?), but I was even more frustrated when I’d come across a note and not remember why I wrote it.

Remember changed all that for me. The key ideas behind Remember are that you should be able to write notes with minimal distraction, and that as the context should be automatically picked up so that you don’t have to write it down. If you’re writing a note based on a mail message, Remember will pick up the details of the message and create a hyperlink so that you can view the original message when reviewing your notes. If you’re working on a file, Remember will link to it so that you can jump back to it. If you’re browsing a web page (in Emacs, of course), Remember will remember the title and URL, so that you can go back to the page when you want to clarify something in your notes. After you save the note, you’ll be back in the same environment you were: no need to switch applications and no need to remember different keyboard shortcuts.

You might think that Remember’s only worth it if you do _everything_ in Emacs. For me, it worked the other way around. I started by using Remember to take notes in Planner, a personal information manager available for Emacs. As I got accustomed to the way Remember and Planner just automatically hyperlinked to whatever I was looking at, I thought: Why doesn’t my mail client do this? Why doesn’t my web browser do this? Why doesn’t my chat client do this? So I ended up reading through the manuals, figuring out how to do all these things in Emacs—and I loved it, eventually doing most of my work (and play!) within an Emacs frame. Although I use other applications now, like Lotus Notes for work mail and Mozilla Firefox for browsing, I still switch back to Emacs for my notes.

In this section, you’ll learn how to set up Remember and take quick notes in Emacs. We’ll start by configuring Remember to save your notes to a file, and how to configure Remember to save to different places depending on the content. You’ll also learn how to quickly search your notes file for entries.

You can also integrate Remember into other note-taking systems in Emacs. The sections that cover those systems will also show you how to configure Remember to save your notes there.

Setting Up Remember

Remember is a separate package, which you can download from https://gna.org/projects/remember-el . As of this writing, the latest stable release is Remember 1.9. Download the latest version and unpack it into your ~/elisp directory. You should end up with a new directory, ~/elisp/remember-1.9 .

To configure Remember to save to plain text files, add this code to your ~/.emacs and evaluate it:

(add-to-list 'load-path "~/elisp/remember-1.9") ;; (1)
(require 'remember-autoloads)
(setq remember-data-file "~/notes.txt")  ;; (2)
(global-set-key (kbd "C-c r") 'remember) ;; (3)

(defun wicked/remember-review-file ()
 "Open `remember-data-file'."
 (interactive)
 (find-file-other-window remember-data-file))
(global-set-key (kbd "C-c R") 'wicked/remember-review-file) ;; (4)
;; Not (global-set-key (kbd "C-c r")... as originally written... Thanks for catching that, Seth!

  • 1: Change this to the directory that contains remember.el
  • 2: Notes will be saved to this file. You can change this if you want; just keep in mind that this section refers to ~/notes.txt.
  • 3: C-c r (remember) is a handy shortcut key for remember. You can also bind it to other shortcut keys such as F9 r.
  • 4: This shortcut makes it easy to check your remembered notes.

After you’ve configured Remember, try it out by typing C-c r (remember). Your Emacs frame will be split in two, and one of the windows will be a *Remember* buffer. Type your note. The first line will be the headline, and the rest of the buffer will be the body of the note. If you call C-c r (remember) from a file, the filename will automatically be included at the end of the buffer. Type C-c C-c (remember-buffer) to save the note.

Try it now by typing C-c r (remember) to bring up the buffer, typing in a short note, and using C-c c (remember-buffer) to save it. If you open ~/notes.txt to review your note, you’ll find something like this:

 ** Sat Jan 12 14:43:02 2008 (Your headline goes here)

 Your note body goes here

 /home/sacha/.emacs

You can even save yourself some copying and pasting. Mark a region of text and use C-u C-c r (remember). The selected text will be included in the buffer, so all you have to do is comment on it.

Make a habit of typing C-c C-r or C-u C-c C-r (remember) when you need to remember something. Type C-c C-c (remember-buffer) to get back to work, knowing that your notes have been safely saved in your ~/notes.txt file.

Reviewing Your Notes

Use C-c R (wicked/remember-review-file) to check your notes, or open ~/notes.txt yourself.
To search your notes, use C-c R (wicked/remember-review-file) to open the file, then use C-s (isearch-forward) to search for words interactively, or use M-x occur to find all lines containing a word.

You may notice that the default format that Remember uses is an outline format that is compatible with Org and Allout, both of which have powerful outline-editing tools. I prefer Org’s outline-editing commands, and you’ll learn about them in the “Outline Notes with Org” section. Here’s a quick summary.

First, you need to switch the buffer to Org mode by typing M-x org-mode. To automatically open your notes file in Org mode, add

-*- mode: org -*-

to the first line of your ~/notes.txt. Then, when you open your ~/notes.txt file, it will be in Org mode.

You can quickly collapse or expand all the outline entries by pressing S-TAB (org-shifttab). To collapse or expand a single entry, move the point to the headline (the line beginning with *, **, or any number of asterisks), then press TAB (org-cycle). To move an entry up or down, move the point to the headline and press S-UP (org-shiftup) or S-DOWN (org-shiftdown). To demote or promote a heading, press M-RIGHT (org-metaright) or M-LEFT (org-metaleft).

You can treat ~/notes.txt as your inbox, and keep your organized notes in another file or groups of files. Cut and paste the text between the files to clear your inbox, and use M-x grep to search multiple files. Alternatively, you can keep all of your notes in one large text file, and use C-s (isearch-forward) and M-x occur to search for information.

Now you know the basics of remembering information, saving it into a file, and reviewing the file. By default, Remember annotates your notes with a filename, if you were looking at a file when you called C-c r (remember). As you learn more about Emacs, you may want to configure Remember to add more intelligent annotations and other text to the Remember buffer. The more work Remember does for you, the less work you have to do!

Enabling annotation functions

The easiest way to get Remember to automatically understand mail messages, Web pages, info files, BBDB contact records, and other sources of information in Emacs is to use either Org or Planner. To learn how to integrate Remember with either Org or Planner, read the section on “Outline Your Notes with Org” and “Writing Your Journal with Planner”.

You can also define your own annotation functions. When you call C-c r (remember) from a buffer, Remember goes through each of the functions in remember-annotation-functions, and it uses the first non-nil value returned.

For example, you may work with many temporary buffers that don’t have filenames. To create an annotation function that adds buffer names, add the following code to your ~/.emacs after the basic Remember configuration code:

(eval-after-load 'remember
  '(progn
    (add-to-list 'remember-annotation-functions 'buffer-name t)))

This adds buffer-name to the end of the annotation list, making it a last resort.

What if you want line numbers included with the filename or buffer name? You could replace the previous code with this:

(defun wicked/remember-line-numbers-and-file-names ()
 "Return FILENAME line NUMBER."
 (save-restriction
  (widen)
   (format " %s line %d"
    (or (buffer-file-name) (buffer-name))
    (line-number-at-pos))))
(eval-after-load 'remember
  '(progn
     (add-to-list 'remember-annotation-functions
                  'wicked/remember-line-numbers-and-file-names)))

With that code, C-c r (remember) will automatically pick up the line number from your file or buffer.

By default, Remember saves your notes to a plain-text file, so you’ll have to open the files manually. The command M-x ffap or find-find-file-at-point may be convenient. If you want hyperlinks that you can visit easily, consider saving your notes in an Org or Planner file instead.

Now you’ve got context. What else can you do with the Remember buffer?

Adding Other Text to the Remember Buffer

Remember has plenty of hooks that let you modify the behavior. For example, you might want to insert a random tagline or fortune-cookie saying whenever you create a note. This is a fun way to encourage yourself to write more, because then there’s a little surprise every time you open a Remember buffer.

Here is a totally small-scale way to use random lines from a text file. Let’s say that you have a text file made up of movie quotes, taglines, knock-knock jokes, or short fortune-cookie sayings. When I wrote this code, I used Japanese/English sentence pairs about cats, because I was studying Japanese. You can use whatever tickles your fancy, as long as this text file (~/taglines.txt) has one line per saying.

(defun wicked/random-tagline (&optional file)
  "Return a random tagline."
  (with-current-buffer (find-file-noselect (or file "~/taglines.txt"))
    (goto-char (random (point-max)))
    (let ((string
           (buffer-substring (line-beginning-position)
                             (line-end-position))))
      string)))

(eval-after-load 'remember
  '(progn
     (defadvice remember (after wicked activate)
       "Add random tagline."
       (save-excursion
         (goto-char (point-max))
         (insert "\n\n" (wicked/random-tagline) "\n\n")))))

If you want multi-line sayings, look into the Emacs fortune cookie package, and replace wicked/random-tagline with a function that returns a random string.

This code modifies the behavior of C-c r (remember) by inserting a random tagline after the buffer has been prepared. You can use the same idea to insert a timestamp noting the time you started, use a template, or modify the text in other ways.

Saving to Different Places

You can also change how Remember saves its notes. For example, if you want all of the notes that contain the word “:EMACS:” or “:WORK:” to go into separate files, you can add this code to your ~/.emacs:

(defvar wicked/remember-keywords
  '((":EMACS:" . "~/emacs.txt")
    (":WORK:" . "~/work.txt"))
  "*List of (REGEXP . FILENAME).
If an entry matches REGEXP, it will be storied in FILENAME.
The first regular expression that matches is used.")
(eval-after-load 'remember
  '(progn
     (defadvice remember-region (around wicked activate)
       "Save notes matching `wicked/remember-keywords' elsewhere."
       (let* ((b (or beg (min (point) (or (mark) (point-min)))))
	      (e (or end (max (point) (or (mark) (point-max)))))
	      (string (buffer-substring-no-properties b e))
	      (done nil)
	      (keywords wicked/remember-keywords))
	 (while keywords
	   (when (string-match (caar keywords) string)
	     (let ((remember-data-file (cdar keywords)))
	       ad-do-it)
	     (setq keywords nil done t))
	   (setq keywords (cdr keywords)))
	 (unless done
	   ad-do-it)))))

You can even configure Remember to use different handler functions. This chapter covers several note-taking systems for Emacs, and you may want to use Remember to save to more than one note-taking system. For example, you can set up C-c r p to start a Remember buffer that saves to Planner, and C-c r o to start a Remember buffer that saves to Org. Here’s the code for your ~/.emacs:

(defun wicked/remember-to-org ()
  "Remember to Org."
  (let ((remember-annotation-functions   ;; (1)
	 (cons 'org-remember-annotation
	       remember-annotation-functions)))
    (remember)
    (set (make-variable-buffer-local
	  'remember-handler-functions)
	 '(org-remember-handler))))      ;; (2)

(defun wicked/remember-to-planner ()
  "Remember to Planner."
  (let ((remember-annotation-functions   ;; (3)
	 (append planner-annotation-functions
		 remember-annotation-functions)))
    (remember)
    (set (make-variable-buffer-local
	  'remember-handler-functions)
	 '(remember-planner-append))))      ;; (4)

(global-unset-key (kbd "C-c r"))  ;; (5)
(global-set-key (kbd "C-c r o") 'wicked/remember-to-org)
(global-set-key (kbd "C-c r p") 'wicked/remember-to-planner)
  • 1: We need to make sure that Org-compatible links are created.
  • 2: This makes C-c C-c save the note to the Org file.
  • 3: Planner uses a list of annotation functions, so we add all of them to the beginning of the list.
  • 4: This makes C-c C-c save the note to the Planner page.
  • 5: We need to unset keyboard shortcuts before we can set longer keyboard shortcuts that start with the same sequence.

To learn more about configuring Remember with the different note-taking systems, read the sections for those systems.

On Technorati: , , ,

Random Emacs symbol: compilation-find-file – Function: Find a buffer for file FILENAME.

Writing plans for the chapter on managing notes

- [ ] Keeping Notes in Emacs
Structured vs Unstructured (outline, free-form)
Flat vs Hyperlinked
Private vs Public
File structure (one file, daily, snippets)

In this section, you’ll learn about the different kinds of notes you take, and you will be able to choose one or two Emacs modules to start learning.

- [ ] Capture and retrieve – Remember, search

Getting the ideas out of your head and into your note-taking system; searching your notes (basic), searching your notes (specific)

Wicked cool code: Remembering to different note-taking systems, searching different note-taking systems

- [ ] Outline Notes with Org, Blorg

In this section, you’ll learn how to keep outlined notes using Org.  You’ll be able to create headings, sub-headings, and text notes. You’ll also learn how to manage outline items by promoting, demoting, and rearranging them. These basic editing commands are covered in the Emacs Org manual, so I’ll just give a brief summary..

You’ll also get tips on how to capture text quickly (M-x remember, dabbrev), work with large outline files (split windows are useful), and search your notes efficiently (searching headings or text).

Lastly, you’ll learn how to publish your Org file as HTML or LaTeX.

Wicked cool code would be: searching, how to import to and export from Freemind, a graphical mind-mapping program.

- [ ] Daily Notes with Planner

In this section, you’ll learn how to write a day-based journal using Planner. In addition to free-form notes on the page, you’ll also be able to keep semi-structured notes typed in manually or captured using Remember. You’ll also learn how to publish the resulting pages as HTML and RSS, and how to customize the output.

Wicked cool code would be: searching notes and displaying matching headlines, private notes, publishing note headlines, and publishing a note index.

- [ ] Hyperlinked Notes with Muse

In this section, you’ll learn how to create a personal wiki using Muse.  You’ll learn how to create pages, link to pages, and publish your wiki.

Wicked cool code: Capturing notes to specific pages using Remember and keyword matches, private pages, publishing pages when you save them.

- [ ] Snippets with Howm

In this section, you’ll learn how to manage random snippets of information using Howm.

- [ ] Blogging from Emacs – WordPress, LJ, Blogger,Muse-Blosxom, EmacsAtomAPI

In this section, you’ll learn how to use Emacs as a blogging client for many popular platforms. This is mainly for keeping other blogs in sync, although I’ll also talk about the possibility of using planner-rss + something like Feedwordpress.

- [ ] Encrypted Notes (full file, segments) – MOSTLY WRITTEN

In this section, you’ll learn how to encrypt your notes. Actually, this will probably be split up into the different tools…

Tagging in Org – plus bonus code for timeclocks and tags!

The section on projects introduced tags as a way to differentiate
active and inactive projects. In this section, you’ll learn more about
tags and how you can use them to filter your task list.

What’s a tag, anyway? In Org, tags are keywords at the end of
headlines. Each tag can contain letters, numbers, and the symbols ‘_’
and ‘@’. Tags begin and end with colons, and a single colon separates
multiple tags. For example, you could have headlines like this:

 * Personal                                     :PERSONAL:
 ** TODO Buy milk                               :@ERRANDS:
 ** TODO Call Mom                               :@PHONE:
 ** TODO Send letters                           :@ERRANDS:
 * Work                                         :WORK:
 ** TODO Call John about report                 :@PHONE:JOHN:
 ** TODO Prepare for presentation on Monday
 ** TODO Call Mary about the presentation       :@PHONE:URGENT:MARY:

One way to use tags is to filter your task list by priority. For
example, you may want to focus on your urgent tasks first without
getting distracted by other items on your task list. Another way to
use tags is to keep track of the context of your tasks as suggested in
GTD. By doing similar tasks together, you might be able to work more
efficiently. For example, if you’re on the phone at the office, it may
be a good idea to do all of your work-related phone calls. If you’re
going to go to the post office, you might want to drop by the
supermarket on your way back. You can use tags to categorize your
headlines any way you want.

Tags can take advantage of the outline structure. For example,
although the tasks “Buy milk”, “Call Mom”, and “Send letters” have one
tag each, they also inherit the “PERSONAL” tag from the parent
headline. A tag search for “PERSONAL” would display all three
tasks. To customize this behavior, look at the documentation for the
variables org-use-tag-inheritance and org-tags-match-list-sublevels.

Tags can help you organize and filter your task list. In this section,
you’ll learn how to add tags to your headlines, view tagged items in
your Org file and in your agenda, and define custom agenda
views. You’ll also learn about custom tag searches and other
interesting things you can do once you’ve tagged your headlines.

Adding tags

You can edit your ~/organizer.org file and add tags manually by typing
in :tagname: at the end of the headline. You can also add tags by
typing C-c C-c (org-ctrl-c-ctrl-c) when the point is on a
headline. Use M-TAB (complete-symbol) to complete a tag based on all
the tags used in the current file. If Alt-TAB is not processed by
Emacs, you can use ESC-TAB instead.

Separate multiple tags with a single colon, like this:
(:@PHONE:URGENT:). The beginning and ending colons are optional when
using C-c C-c (org-ctrl-c-ctrl-c), because the function will
automatically add them.

If you add certain tags frequently, you can set up single-key
shortcuts. For example, if you frequently tag tasks as “URGENT”, you
may want to define a shortcut (at least until your life gets under
control). You can assign shortcuts globally by adding this code to
your ~/.emacs and evaluating it:

   (setq org-tag-alist '(("URGENT" . ?u)
                         ("@PHONE" . ?p)
                         ("@ERRANDS" . ?e)))

You can also set this on a per-file basis by adding the following line
to the beginning of your file:

 #+TAGS: URGENT(u) @PHONE(p) @ERRANDS(e)

You can then use these C-c C-c (org-ctrl-c-ctrl-c) to enter these
single-key shortcuts, ending it with RET. If you are assigning a
single tag, type C-c C-c C-c (org-ctrl-c-ctrl-c, next change exits) to
make it even faster by skipping the RET.

If you use single-key shortcuts, you’ll need another way to enter tags
that start with the shortcut key. You can type them in manually, or
you can use C-c C-c (org-ctrl-c-ctrl-c) and type TAB to enter in any tag.

To remove a tag, you could use C-c C-c (org-ctrl-c-ctrl-c) again, or
delete it manually. To remove all tags, use C-c C-c
(org-ctrl-c-ctrl-c) and press SPC.

Viewing tagged items

Whether you want to view tagged headlines by themselves or in the
context of your other headlines, tasks, and notes, Org has some nifty
tagging features for you.

Agenda view

To view tagged headlines by themselves, use C-c a m (org-agenda,
org-tags-view) and specify the search tag. For example, you can view
your urgent tasks by specifying “URGENT”. Note that this command
displays the top headlines matching that tag, whether they’re tasks or
not. For example, if you searched for “WORK”, you would just get the
“* Work” headline. To view tagged tasks, use C-c a M (org-agenda,
org-tags-view with a prefix argument). This shows only the tasks that
have that tag.

To search for a combination of tags, you can combine tags like this:

WORK&@PHONE           only your work phone calls
PERSONAL-@ERRANDS     personal tasks, but without errands
JOHN|MARY             Anything tagged with "JOHN" or "MARY"
                      For example, if you're going to have a meeting with both of them

If you check certain lists often, you might want to create a custom
agenda command for them. In the section on Projects, you configured
custom agenda commands for active and inactive projects by adding the
following code in your ~/.emacs:

(setq org-agenda-custom-commands
      '(("p" tags "PROJECT-MAYBE-DONE" nil)
        ("m" tags "PROJECT&MAYBE" nil)
        ("a" "My agenda"
         ((org-agenda-list)
          (tags "PROJECT-MAYBE-DONE")))
        ;; ... put your other custom commands here
       ))

You can use the same idea to create quick custom views for your other
tagged tasks. For example, to create custom views for your urgent work
tasks and your phone calls, modify the org-agenda-custom-commands
setting in your ~/.emacs to be like this:

(setq org-agenda-custom-commands
      '(("u" todo "WORK&URGENT" nil)               ;; (1)
        ("c" todo "WORK&@PHONE" nil)               ;; (2)
        ("h" todo "PERSONAL-@ERRANDS" nil)         ;; (3)
        ("p" tags "PROJECT-MAYBE-DONE" nil)        ;; (4)
        ("m" tags "PROJECT&MAYBE" nil)
        ("a" "My agenda"
         ((org-agenda-list)
          (tags-todo "URGENT")                     ;; (5)
          (tags "PROJECT-MAYBE-DONE")))            ;; (6)
        ;; ... put your other custom commands here
       ))
  • (1) “u” is for “urgent”, “todo” specifies that TODO headlines are to be shown, “WORK&URGENT” is the query string, and the last item means that there aren’t any options
  • (2) “c” is for “call”
  • (3) “h” is for “home”
  • (4) The second item here is “tags” instead of “todo”, which means that the highest-level matching headlines should be shown whether or not they’re tasks.
  • (5) This is how to add a tag search for tasks into a custom agenda command.
  • (6) This is how to add a tag search for headlines into a custom agenda command.

Sometimes you’ll want to see more context instead of just a list of
headlines. You can jump from your Org agenda to the corresponding
headline by pressing RET (org-agenda-switch-to) on the entry. You can
also quickly browse through the headlines in another window by
pressing f (org-agenda-follow-mode) while in the Org agenda view, then
moving your point to the different lines. These commands work with the
summary in the Org agenda view.

If you want to show only matching headlines in your ~/organizer.org
file, you can use Org’s sparse tree search commands.

In your agenda file

A sparse tree shows only the matching headlines in the context of the
headlines above them. This is useful when you want to see your tasks
within your outline structure. All other headlines are collapsed so
that they’re easy to skip. To do a sparse tree search, type C-c \
(org-tags-sparse-tree). You can then expand and collapse subtrees with
the TAB (org-cycle) command. To limit the search to only task
headlines, type C-u C-c \ (org-tags-sparse-tree with a prefix).

Other cool things you can do with tags

And if you ever want to know how much time you spent on urgent tasks,
you can call the following function from your organizer.org file with:

M-x wicked/org-calculate-tag-time RET URGENT RET

to see something like this:

Time: 98:44 (98 hours and 44 minutes)

You can call it with a prefix in order to be prompted for a start time
(inclusive) and end time (exclusive).

Here’s the code to add to your ~/.emacs:

(defun wicked/org-calculate-tag-time (matcher &optional ts te)
  "Return the total minutes clocked in headlines matching MATCHER.
MATCHER is a string or a Lisp form to be evaluated, testing if a
given set of tags qualifies a headline for inclusion. TS and TE
are time start (inclusive) and time end (exclusive). Call with a
prefix to be prompted for TS and TE.

For example, to see how much time you spent on tasks tagged as
URGENT, call M-x wicked/org-calculate-tag-time RET URGENT RET. To
see how much time you spent on tasks tagged as URGENT today, call
C-u M-x wicked/org-calculate-tag-time RET URGENT RET . RET +1 RET."
  (interactive (list
		(read-string "Tag query: ")
		(if current-prefix-arg (org-read-date))
		(if current-prefix-arg (org-read-date))))
  ;; Convert strings to proper arguments
  (if (stringp matcher) (setq matcher (cdr (org-make-tags-matcher matcher))))
  (if (stringp ts)
      (setq ts (time-to-seconds (apply 'encode-time (org-parse-time-string ts)))))
  (if (stringp te)
      (setq te (time-to-seconds (apply 'encode-time (org-parse-time-string te)))))
  (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\("
		     (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
		     (org-re
		      "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*$")))
	 (case-fold-search nil)
         lspos
	 tags tags-list tags-alist (llast 0) rtn level category i txt p
	 marker entry priority (total 0))
    (save-excursion
      (org-clock-sum ts te)
      (goto-char (point-min))
      (while (re-search-forward re nil t)
	(catch :skip
	  (setq tags (if (match-end 4) (match-string 4)))
	  (goto-char (setq lspos (1+ (match-beginning 0))))
	  (setq level (org-reduced-level (funcall outline-level))
		category (org-get-category))
	  (setq i llast llast level)
	  ;; remove tag lists from same and sublevels
	  (while (>= i level)
	    (when (setq entry (assoc i tags-alist))
	      (setq tags-alist (delete entry tags-alist)))
	    (setq i (1- i)))
	  ;; add the nex tags
	  (when tags
	    (setq tags (mapcar 'downcase (org-split-string tags ":"))
		  tags-alist
		  (cons (cons level tags) tags-alist)))
	  ;; compile tags for current headline
	  (setq tags-list
		(if org-use-tag-inheritance
		    (apply 'append (mapcar 'cdr tags-alist))
		  tags))
	  (when (and (eval matcher)
		     (or (not org-agenda-skip-archived-trees)
			 (not (member org-archive-tag tags-list))))
	    ;; Get the time for the headline at point
	    (goto-char (line-beginning-position))
	    (setq total (+ total (or (get-text-property (1+ (point)) :org-clock-minutes) 0)))
	    ;; if we are to skip sublevels, jump to end of subtree
	    (org-end-of-subtree t)))))
    (if (interactive-p)
	(let* ((h (/ total 60))
	       (m (- total (* 60 h))))
	  (message "Time: %d:%02d (%d hours and %d minutes)" h m h m)))
    total))

Now you can slice and dice your timeclock records any way you want, thanks to tags!

Random Emacs symbol: cc-imenu-java-generic-expression – Variable: Imenu generic expression for Java mode. See `imenu-generic-expression’.

On Technorati: , ,

Projects in Emacs Org

Introduction

Organizing your tasks into projects can help you plan ahead, track
your progress, and stay motivated. Working from a project list allows
you to plan your day or week instead of just reacting to other
people’s requests. Keeping your projects and tasks in Org makes it
easier for you to review your completed tasks and plan the next step.
If you include some text describing why you want to do the project and
what your intended outcome is, this can help you stay motivated
throughout a long project.

Projects can take a single day or several years. They can be large
projects involving lots of other people and resources, or small
projects that you do on your own. Projects may involve a handful of
separate steps or a hundred things you need to do in order to achieve
your goal. The important thing is that there is more than one step.
If you organize your task list so that related tasks are together,
then you’ll find it easier to get a sense of where you are, where
you’re going, and what you need to do next.

In this section, you will learn how to:

  • Create projects,
  • Organize your tasks into projects,
  • Review your ongoing projects, and
  • Mark projects as finished.

I’ll assume that you’re using Emacs 22, and that you’ve set up Org
using an ~/organizer.org agenda file and the basic configuration
suggested in either “Org and GTD” or “Org as a Day Planner.” I’ll also
assume that you’re familiar with switching between the Org agenda view
and the Org organizer file, and that you’re comfortable navigating
around Emacs.

The examples I’ll use focus on yearly goals. You might also have
short-term projects or long-term plans. Feel free to adapt the
examples as needed.

Open your ~/organizer.org file. If you’ve collected your tasks as
suggested in the previous sections on Using Org as a Day Planner or
Using Org for GTD, your ~/organizer.org file might look something like
this:

 * Inbox
 ** TODO Read Emacs Lisp intro
 ** TODO Write yearly review
 ** TODO Exercise
 ** TODO Browse the Emacs Wiki

Create new top-level headings for this year’s goals or the projects
that you’re working on. You can create a top-level heading by
typing * and the heading, like this:

 * Learn more about Emacs
 * Go on vacation
 ...
 * Inbox
 ** TODO Read Emacs manual
 ...

It’s a good idea to add the projects to the beginning of the file
(before your Inbox) because M-x remember adds new tasks or notes to
the end of the file. If the last major heading as * Inbox, then the
tasks and notes are automatically added to it. If the last major
heading is a project, the tasks and notes may get misfiled.

What are your projects?
Yearly goals? I’ve got twenty-year plans!

If you’re a top-down planner, you’ll find it easy to list your
projects. In fact, you might have a ten- or even twenty-year plan
already written down. You’ll find this section straightforward,
because you’re already used to planning in terms of projects.
Go ahead and adapt the examples to your long-term plans.

Yearly goals? I live day by day!

If you’re a bottom-up planner, you might be giving me a weird look
right now. “Yearly goals? I’m lucky if I can figure out how to get
through the next day!” This section will also show you how to find the
recurring themes in your task list and organize them into projects.
Give project-based planning a try for a month. If this way of thinking
doesn’t work for you, Org will work just fine without projects.

You probably have projects, even if you can’t think of any right
now. Review your ~/organizer.org file. If you haven’t written down
everything you needed to do yet, go through the section on basic
configuration for your planning style (GTD or day planning). Once you
have a list of things to do, you can then review it for big tasks,
related tasks, and other project clues.

Read your tasks and ask yourself the following questions:

  • *Can I do this in one sitting?* Big tasks such as “Write a book” are often projects in disguise. Use projects so that you can break them down into smaller, doable tasks.
  • *Is this related to other tasks?* Related tasks such as “Book a flight” and “Plan my itinerary” are often clues to a project like “Go on vacation”. Use projects so that you can review related tasks together.
  • *Why am I doing this?* When you think about the reason why you’re doing something, you’ll often find a bigger project. For example, if one of your tasks is “Set up an automatic retirement savings plan”, then the question “Why am I doing this?” may lead you to the project “Plan for retirement”. Use projects to help you think of other ways to move towards that goal.

Big tasks need to be broken down into smaller tasks anyway, and
organizing them into projects will help you make them more
manageable. You may not want to organize all of your other tasks into
projects. If you can pick some major themes to focus on, though, then
you’ll be able to see how the different things you do are related to
each other, and you’ll be able to think of other ways to work on those
projects. If you’re starting out with project-based thinking, maybe
you can pick three to five projects and try to do a little work on
each of them every day.

If you still don’t identify any projects, that’s okay. You can use Org
as a straightforward task list. Jump ahead to the section on “Tags”,
as you’ll probably find that useful.

On the other hand, if this step turns up plenty of projects, resist
the temptation to over-correct and end up with hundreds of projects. I
find that more than 7 active projects gets hard to manage. Pick a few
main themes that you’d like to work on, and make everthing else
something you plan to do someday.

Project tasks

Creating tasks

Now that you have project headings, think of the next thing you need
to do in order to move those projects forward. If you’ve already
written down those tasks, move them under the appropriate project
heading. If not, type them in.

In order for a task to belong to a project, it needs to be under the
heading and at a lower level. For example, if your project heading has
one star, like this:

 * Learn Emacs

then your TODO headings should have two stars, like this:

 * Learn Emacs
 ** TODO Read the Emacs manual
 ** TODO Read the Emacs Lisp Intro manual (eintr)
 ** TODO Install the Emacs source code

If your tasks are not at the right level, you can add the star
manually by editing the heading. You can also use M-right and M-left
(org-metaright and org-metaleft) while on a heading in order to
promote or demote it, and you can use M-S-right and M-S-left
(org-shift-metaright and org-shift-metaleft) to promote or demote
entire subtrees.

To move tasks up and down within the project, you can copy and paste
the text. You can use M-Up and M-Down (org-metaup and org-metadown) to
move subtrees.

Think of tasks you can do within the next week in order to move each
of your projects forward. Add next actions to all of your active
projects. Creating next actions for each of your projects makes it
easier to remember to keep moving forward.

Organizing tasks

If you have many tasks in a project, you may want to organize them
into sub-projects. For example, you might divide a software project
into components. If you’re starting from scratch, you can create the
project structure by typing in more stars for sub-project
headings. For example:

 * Learn Emacs
 ** Read mail
 *** TODO Choose a mail client
 *** TODO Install and configure the mail client
 *** TODO Send a message
 ...
 ** Browse the Web
 *** Read through the w3m documentation
 ...

You can also demote an existing project into a subproject.
Use M-S-right (org-shift-metaright) on the
current project headline in order to demote it to a sub-project. This
will also demote the tasks within the project. For example, demoting
this:

 * Learn Emacs
 ** TODO Choose a mail client
 ** TODO Install and configure the mail client
 ** TODO Send a message

will result in this:

 ** Learn Emacs
 *** TODO Choose a mail client
 *** TODO Install and configure the mail client
 *** TODO Send a message

Then you can change the heading and add another heading above it, like this:

 * Learn Emacs
 ** Read mail
 *** TODO Choose a mail client
 *** TODO Install and configure the mail client
 *** TODO Send a message

This kind of organization is optional, but it can help you get an idea
of the overall structure of your project. Using different levels
allows you to hide and show groups of headings by pressing TAB on the
heading.

Now that you’ve created your project tasks and organized them the way
you want, it’s time to actually do the work.

Working on tasks

If you use Org as a day planner, you may also want to schedule the
tasks onto specific days with C-c C-s (org-schedule). You can review
your daily or weekly agenda with C-c a a (org-agenda,
org-agenda-list), switching between daily and weekly views with d and
w (org-agenda-day-view and org-agenda-week-view).

You can work with the next actions in the same way you work with other
tasks, rescheduling them or marking them as STARTED, WAITING or DONE
with the keyboar shortcuts introduced in the previous section on Org
and GTD or Org as a Day Planner.

When you finish a project task, think of the next action you can do in
order to move that project forward. If you use Org as a day planner,
schedule the next action onto your calendar as well.

Reviewing projects

You can review your projects by opening your ~/organizer.org and
browsing through the headings. S-tab (org-shifttab) changes the
visibility of headings, so you can see just the top-level headings or
all the details. You can use TAB (org-cycle) on a headline to show or
hide subtrees.

Reviewing a list of projects

If you have many projects, you’ll want a shorter view of just your
active projects. To make it easier to review projects, add a PROJECT
tag to all your active project headlines. You can add a tag by
editing your ~/organizer.org and moving your cursor to the headline
and typing C-c C-c (org-ctrl-c-ctrl-c), followed by the name of the
tag (PROJECT). You can also manually type :TAGNAME: at the end of the
headings, like this:

 * Learn more about Emacs        :PROJECT:
 ** TODO Read the Emacs manual
 ** TODO Read the Emacs Lisp Intro manual (eintr)
 ...
 * Go on vacation                :PROJECT:
 ...
 * Inbox
 ...

You might classify some of your projects as someday/maybe – things
that are nice to think about, but which you aren’t acting on right
now. Tag your inactive or someday/maybe projects with PROJECT and
MAYBE. If you’re editing the ~/organizer.org file, just
add :PROJECT:MAYBE: to the heading. If you’re tagging it with C-c C-c
(org-ctrl-c-ctrl-c), specify PROJECT:MAYBE as the tag.

 * Learn more about Emacs        :PROJECT:
 * Go on vacation                :PROJECT:MAYBE:
 ...
 * Inbox
 ** TODO Read Emacs manual
 ...

Now that you’ve tagged your projects, you can view just your project
headlines with a custom agenda command. Custom agenda views are a
terrific feature in Org, and you can do a lot with them if you know a
little Emacs Lisp. Here’s what you need to add to your ~/.emacs in
order to get a list of your active projects and your someday/maybe
projects:

(setq org-agenda-custom-commands
      '(("p" tags "PROJECT-MAYBE-DONE" nil)  ;; (1)
        ("m" tags "PROJECT&MAYBE" nil)       ;; (2)
        ;; ... put your other custom commands here
       ))
  • (1) This makes C-c a p (org-agenda, p) show your active projects.
  • (2) This makes C-c a m (org-agenda, m) show your “maybe” projects.

With these two commands, you can quickly review your active and
inactive projects. To jump to a project from the agenda view, move
your cursor to the heading and press RET (org-agenda-switch-to). If
you want to scan through the projects quickly, use f
(org-agenda-follow-mode) in the agenda view to turn on follow mode,
then move to different headlines. Another window will show the
headline at point.

If you review your projects at least once a week, you’ll find it
easier to make regular progress. If you want to combine your
weekly/daily review with your project list, you can do that with
org-agenda-custom-commands as well. Here’s what you’d put in your
~/.emacs:

(setq org-agenda-custom-commands
      '(("p" tags "PROJECT-MAYBE-DONE" nil)
        ("m" tags "PROJECT&MAYBE" nil)
        ("a" "My agenda"                            ;; (1)
         ((org-agenda-list)                         ;; (2)
          (tags "PROJECT-MAYBE-DONE")))             ;; (3)
        ;; ... put your other custom commands here
       ))
  • (1) The first argument is the shortcut key, the second is a name for the agenda view
  • (2) Your daily or weekly agenda. The d and w (org-agenda-day-view and org-agenda-week-view) shortcuts work if the point is within this section
  • (3) A list of your active projects

This configures C-c a a (org-agenda, “My agenda”) to display your
agenda and a list of your project headings. Again, you can press RET
(org-agenda-switch-to) to jump to a project from its heading in the
agenda view.

Reviewing your stuck projects

You might have forgotten to create next actions for some of your
active projects. Org can help you find projects which don’t have next actions.
You can then decide if the project is complete or if it needs further action.

To list stuck projects, you first need to tell Org what a stuck
project is. The following code defines a stuck project as an active
project (not tagged “maybe” or “done”) that doesn’t have a TODO or
STARTED action, if the body of the project doesn’t contain “*lt;IGNORE>”. Add this to your ~/.emacs and evaluate it:

(setq org-stuck-projects
      '("+PROJECT/-MAYBE-DONE" ("TODO" "STARTED") nil "\\<IGNORE\\>"))

Then you can use M-x org-agenda-list-stuck-projects or C-a a #
(org-agenda, org-agenda-list-stuck-projects) to show only the stuck
projects. Review this list and jump to the headlines.

Want to add that to your custom agenda view? Modify the org-agenda-custom-commands value in your ~/.emacs to be like this:

(setq org-agenda-custom-commands
      '(("p" tags "PROJECT-MAYBE-DONE" nil)
        ("m" tags "PROJECT&MAYBE" nil)
        ("a" "My agenda"
         ((org-agenda-list)
          (org-agenda-list-stuck-projects)          ;; (1)
          (tags "PROJECT-MAYBE-DONE")))
        ;; ... put your other custom commands here
       ))
  • (1) It’s a good idea to put it before your regular project list so that you can see what needs your attention.

What about finished projects? You might want to keep them in your Org
file, but they shouldn’t show up in your active and inactive project
lists. Org can keep track of those projects too.

Marking projects as done

If you look at the custom commands above, you’ll notice the “-DONE”
specifier. “DONE” is the tag we’ll use to indicate done projects. To
tag a project as done, move the point to the project heading and type
C-c C-c (org-ctrl-c-ctrl-c). The tag prompt will default to the
current tags. Just add “DONE” and press Enter. With the custom
commands we’ve set up, projects tagged DONE will not show in your
active, inactive, or stuck project lists.

You can also add the tag manually. For example, if the project heading is

 * Learn Emacs    :PROJECT:

and you’re happy with your level of Emacs proficiency, then you can
mark it as done by changing it to

 * Learn Emacs    :PROJECT:DONE:

If you have plenty of completed projects, your Org file might be quite
large. You can mark a subtree for archiving by typing C-c C-x C-a
(org-toggle-archive-tag). This hides it from most Org commands. You
can also archive a tree into a different file with C-c C-x C-s
(org-advertized-archive-subtree).

Wrapping up

Now you can create projects, manage your project tasks, and review
your active, inactive, and stuck projects in Org. You know how to mark
projects as completed and how to archive them. You’ve also started
using tags to dynamically generate reports from your Org file.

Tags can do a lot more. To find out what else you can do with tags,
read the next section on “Tagging in Org”.

On Technorati: , ,

Clocking Time with Emacs Org

2Many professionals bill clients for their time. Even if you don’t, keeping track of the time you actually spend on tasks can help you improve your time estimates and check if you’re spending enough time on the things that are important to you. For example, keeping track of the time you spend on tasks might show you that you spend two and a half hours each day just responding to e-mail. If you can identify problem areas like that, then you can look for more effective ways to perform the tasks that take up a lot of your time.

I love Org’s timeclocking support, and I think you will too. Because it’s integrated with your task list, you don’t have to switch to separate application or reenter data. You can get more detailed time reports, too. All you have to do is remember to clock in before you start a task and clock out when you finish it.

Starting and stopping the clock

You can clock in by moving your cursor to the task headline in either your organizer.org file or the org agenda view, and then pressing C-c C-x C-i (org-agenda-clock-in or org-clock-in, depending on context). This adds the time stamp to the task. If you are already clocked into another task in that organizer file, you’ll be clocked out of it to prevent you from accidentally double-billing.

To clock out of a task, type C-c C-x C-o from the task headline. Marking a task as done will also automatically stop the clock, if that was the task with the active clock.

Here’s some code to make this even easier. The following code clocks in whenever you market task is started, and clocks out when you market a task as WAITING. It also automatically market task is started if you clock in. This takes advantage of the Org configuration previously suggested in the Setup section. Add this to your ~/.emacs and evaluate it:

(eval-after-load 'org
  '(progn
     (defun wicked/org-clock-in-if-starting ()
       "Clock in when the task is marked STARTED."
       (when (and (string= state "STARTED")
		  (not (string= last-state state)))
	 (org-clock-in)))
     (add-hook 'org-after-todo-state-change-hook
	       'wicked/org-clock-in-if-starting)
     (defadvice org-clock-in (after wicked activate)
      "Set this task's status to 'STARTED'."
      (org-todo "STARTED"))
    (defun wicked/org-clock-out-if-waiting ()
      "Clock out when the task is marked WAITING."
      (when (and (string= state "WAITING")
                 (equal (marker-buffer org-clock-marker) (current-buffer))
                 (< (point) org-clock-marker)
	         (> (save-excursion (outline-next-heading) (point))
		    org-clock-marker)
		 (not (string= last-state state)))
	(org-clock-out)))
    (add-hook 'org-after-todo-state-change-hook
	      'wicked/org-clock-out-if-waiting)))

What if you forgot to clock into a task when you started? No problem. Simply clock in and out of it, then edit the starting timestamp for the task in your ~/organizer.org file. To find a starting timestamp, move your cursor to the task headline. If the task has been collapsed to a single line, press TAB to expand it. Look for a line that starts with CLOCK:, or a collapsed segment that starts with :CLOCK:. If you see a collapsed segment, he expanded by moving a cursor to it and pressing tab. Find the clock entry you want to change, and if the timestamp, and press C-c C-y (org-evaluate-time-range) to update the time total.

Reporting time

By project

To see how much time you’ve spent on a project or task, open your ~/organizer.org file and press C-c C-x C-d (org-clock-display). Total times will be added to each headline, summarizing the times for each subtree.

You can also use one of Org’s dynamic blocks. Open your ~/organizer.org file, move your cursor to where you want the report inserted, and type C-c C-x C-r (org-clock-report). By default, the reports will include all the second-level headings for all the days.

What if you want to limit the report to just the time you clocked last week?

Reporting time for a period

To summarize it for a span of days, change the starting line from:

#+BEGIN: clocktable :maxlevel 2 :emphasize nil

to something like:

#+BEGIN: clocktable :maxlevel 2 :emphasize nil :tstart "<2007-12-25 Sun>" :tend "<2007-12-31 Mon>"

where tstart is the starting time/date and tend is the ending time/date. You can add the timestamps either manually or with C-c C-. (org-time-stamp). After you change the block definition, update the clock table by typing C-c C-x C-u (org-dblock-update).

You can also use a definition like:

#+BEGIN: clocktable :maxlevel 2 :emphasize nil :block today

to see today’s entries. Other block keywords are ‘yesterday’, ‘thisweek’, ‘lastweek’, ‘thismonth’, ‘lastmonth’, ‘thisyear’, or ‘lastyear’.

If you need more levels of headings, change the value of maxlevel. For example, to see a detailed clock table with up to 10 levels of headings, use

#+BEGIN: clocktable :maxlevel 10 :emphasize nil :block today

clocktable summarizes the reported time. What if you want the time broken down by day?

Reporting time by days

The following code creates a custom dynamic block that breaks the reported time by date. Add the following code to your ~/.emacs:

(defun org-dblock-write:rangereport (params)
  "Display day-by-day time reports."
  (let* ((ts (plist-get params :tstart))
         (te (plist-get params :tend))
         (start (time-to-seconds
                 (apply 'encode-time (org-parse-time-string ts))))
         (end (time-to-seconds
               (apply 'encode-time (org-parse-time-string te))))
         day-numbers)
    (setq params (plist-put params :tstart nil))
    (setq params (plist-put params :end nil))
    (while (<= start end)
      (save-excursion
        (insert "\n\n"
                (format-time-string (car org-time-stamp-formats)
                                    (seconds-to-time start))
                "----------------\n")
        (org-dblock-write:clocktable
         (plist-put
          (plist-put
           params
           :tstart
           (format-time-string (car org-time-stamp-formats)
                               (seconds-to-time start)))
          :tend
          (format-time-string (car org-time-stamp-formats)
                              (seconds-to-time end))))
        (setq start (+ 86400 start))))))

After you load that code, you’ll be able to use a dynamic block of the form

#+BEGIN: rangereport :maxlevel 2 :tstart "<2007-12-25 Tue>" :tend "<2007-12-30 Sun>"
...
#+END:

to see your time reported by date. Fill it in by moving your cursor within the block and typing C-c C-x C-u (org-dblock-update).

Org makes it easy to capture timeclock information by integrating the timeclock into your task list so that you don’t even have to think about it, and it can report this time by project or by date. You can use this information to bill clients, improve your time estimates, or reflect on the way you do things. All you have to do is clock in by marking a task as STARTED, and clock out by marking a task as WAITING or DONE. Don’t get discouraged if the time clock shows you do only a few hours of productive work each day. Use that to help you figure out how to do to things better!

On Technorati: , ,

Random Emacs symbol: term-previous-matching-input-string – Function: Return the string matching REGEXP ARG places along the input ring.

How to use Emacs Org as a Basic Day Planner

So you want to use Org as day planner. I’ll show you the bare minimum that you need in order to use Org to manage your tasks day by day. I assume that you’ve set up Org and Remember according to the basic configuration suggested in “Setup.” If you haven’t done that yet, please review the section on “Setup”, then return here.

Here’s what you’ll learn how to do:

  1. Collect your tasks
  2. Schedule the tasks for specific days
  3. View your daily or weekly agenda
  4. Mark tasks as done
  5. Reschedule a task
  6. Review your accomplishments

Collecting your tasks

If you’re adding many tasks, you may find it easier to edit your Organizer file. Open ~/organizer.org in Emacs and go to the end of the file. Add headlines like this:

 * Inbox
 ** TODO your task description here
 ** TODO another task...

Instead of typing ** TODO again and again, you can use C-M-RET to create another TODO heading at the same level as the previous one. Think of all the things you need to do over the next few days and add them to your Org agenda file.

More tasks will come up as you work on things. Instead of switching to your Org agenda file each time you need to add a task, you can use C-c r t (remember, Tasks template) to remember the task quickly. Try it now by typing C-c r t. Type in the task description and press C-c C-c (org-ctrl-c-ctrl-c) to add the task to the end of the ~/organizer.org file.

Now you have plenty of tasks on your list, but no idea when you need to do that. Here’s where scheduling and deadlines come in.

Scheduling tasks

To schedule a task, move your cursor to the TODO headline and press C-c C-s (org-schedule). Org will prompt you for a date. It understands full, partial, and relative dates. For example, if today is December 29, 2007, then It understands any of the following:

Input Result Explanation
(blank) 2007-12-30 Today
10:30 2007-12-30 10:30 Time today
3:30pm 2007-12-30 15:30 Time today
31 2007-12-31 Day in the current month
12-31 2007-12-31 Month and day in the current year
2008-01-01 2008-01-01 Date
2008-01-01 12:30am 2008-01-01 00:30 Date and time (also works with partial dates)
+2 2008-12-31 Two days from now
-3 2007-12-26 Three days ago
Fri 2008-01-04 The nearest Friday (on or after today)
+2w 2008-01-12 Two weeks from today

To set a deadline for a task, type C-c C-d (org-deadline). It accepts the same kinds of date that org-schedule does.

Try this out by scheduling all of your tasks over the next few days, adding deadlines where necessary.

Now that you’ve added date information to your tasks, you probably want to see those tasks organized by date instead of in the random way you entered them. Agenda views are going to become your new best friend.

Viewing your daily or weekly agenda

Type C-c a a (org-agenda, org-agenda-list) to view your agenda. By default, Org shows a weekly view of your scheduled tasks and appointments. This is your Org agenda view.

Here are some useful navigational keys:

  • Switch to a daily view with d (org-agenda-day-view)
  • Switch to a weekly view with w (org-agenda-week-view)
  • View earlier or later days/weeks with your left and right arrow keys (org-agenda-earlier, org-agenda-later)
  • Jump to a specific day with j (org-agenda-goto-date)

Get into the habit of typing C-c a a to check your task list. It may also help to add


(org-agenda-list)

to the bottom of your ~/.emacs. This opens your Org agenda view when you start up Emacs. Start your Emacs day with your Org agenda, check it every time you finish a task, and review it before you end the day. This will help you make sure that nothing falls through the cracks.

Marking tasks as done

The easiest way to mark a task as done is to go to its line in your Org agenda view. Type C-c a a (org-agenda, org-agenda-list) to view your tasks for today, move your cursor to the task, and type t (org-agenda-todo) to cycle the task status until it’s marked DONE. You can also type C-u t (org-agenda-todo with a prefix argument) to jump to a specific task status. For example, you could type C-u t DONE to mark a task as done.

You can also mark tasks done from your ~/organizer.org file. Open the file and move your cursor to the item. Type C-c C-t (org-todo) to change the task status. Again, you can type C-u C-c C-t (org-todo) to jump to a specific task status.

I find it helpful to mark tasks as STARTED when I start working on them, WAITING if I need something else in order to continue working on the task, and DONE when I’m finished with it. That way, I can quickly see which task I was supposed to be working on before I got distracted by something bright and shiny, and I can also see what I’m waiting for. Get into the habit of doing that, and you’ll find it easier to get back on track after distractions.

Unfortunately, Org does not come with a M-x org-zap-distractions command. There will be days when you can’t do everything on your task list.

Rescheduling Tasks

You don’t have to reschedule your tasks. Org will remind you of unfinished, scheduled tasks every single day. It will even helpfully tell you how many days you’ve procrastinated on that task. If you use C-c a a (org-agenda, org-agenda-list) when you have unfinished tasks on previous days, you’ll see task reminders like this:

Saturday  29 December 2007
  organizer: Scheduled:  TODO Respond to mail
  organizer: Sched. 6x:  TODO Write notes from mentoring conversation
  organizer: Sched. 2x:  WAITING Report time

You could let your unfinished tasks snowball on you in a big mass of procrastination. If you let your task list grow to an intimidating size, though, you may start stressing out about the things you aren’t doing. Let me show you how to procrastinate—I mean, reschedule your tasks effectively—so that you can work with a more manageable task list.

If tasks are starting to accumulate, it’s a good sign that you need to review those tasks. Do you really need to do them? If not, delete them by moving to the line in your Org agenda view and pressing C-k (org-agenda-kill). You can also edit your ~/organizer.org file and delete them, but org-agenda-kill is more convenient.

If you really need to do the tasks, but there’s no point in seeing it in today’s task list because you can’t do it today anyway, use C-c C-s (org-agenda-schedule) to reschedule the task. If you’re only moving it a couple of days ahead, use S-right (org-agenda-later) to move it forward, and S-left (org-agenda-earlier) if you overshoot.

Some tasks show up again and again on your task list, and you know you need to do them, but you don’t know where to getting started. “TODO Write a book” is not a good task, because it’s just too big to do in one sitting and it doesn’t tell you what to do right now. Big tasks are often projects in disguise. Break it down into smaller tasks, and schedule those instead. If you’re in the Org agenda view, press RET (org-agenda-switch-to) to jump to the task in your ~/organizer.org file. Break it down into smaller tasks by adding sub-headings and more TODOs, like this:

 ** Write a book
 *** TODO Make an outline of what to write
 *** TODO Read sample query letters
 *** TODO Write a query letter

… and so on.

Then you can use C-c C-s (org-schedule) to schedule those tasks.

Use these commands to keep your task list manageable. That way, you get the warm and fuzzy feeling of accomplishment when you finish what’s on your list and you look at everything you’ve done today.

Reviewing your accomplishments

If you’ve been good about keeping your tasks in your ~/organizer.org file, working with your Org agenda view, and marking tasks as DONE when you finish them, you’ll find it easy (and satisfying!) to review your accomplishments. Just open your daily or weekly Org agenda view with C-c a a (org-agenda, org-agenda-list). Type l (org-agenda-log-mode) to show completed tasks. Pat yourself on the back, then plan yourself another wonderful day tomorrow!

On Technorati: , ,

Random Emacs symbol: set-fill-column – Command: Set `fill-column’ to specified argument.