This page needs attention!



Org-mode is an Emacs mode for note keeping, project planning, TODO lists and authoring. It is included from Emacs 22.1 onward as default.

Org-mode’s manual, compact guide, the community maintained Worg (which includes tutorials, ideas, code snippets, Org Syntax, etc.,) and can be accessed at its homepage. Paperback manual is also available.


Download and Install

The development version is at:

    git clone

There is a Ubuntu repository with the latest for non-cvs Emacs. Add the following to your /etc/apt/sources.list:

    deb gutsy main
    deb-src gutsy main

Texts on using org-mode

David O’Toole has written a general tutorial with screenshots. It has been translated into Chinese, French, Hungarian, Japanese and Korean. Worg has many tutorials on specific features. Charles Cave has has written on using date and times. Bernt Hansen describes his use and customizations of Org-mode in 70(!) pages long document, which assumes basic familiarity with Org.

One of the major influences in 2006/2007 on task organization has been the book Getting Things Done (GTD). Using Org-mode for GTD has been described by Charles Cave and a modest example configuration has been given here.

Eric Neilsen has a cookbook of Org configuration snippets. Bernt Hansen wrote about lots of things you can do with Org. SachaChua has a graphical map for learning Org.

Somewhat dated (2007): Both John Wiegley and Sacha Chua have described day planner usage. Another piece by SachaChua is "A day in the life with Org".


You can publish to HTML using ‘C-c C-e h’, or you can use BhlMode for LaTeX or HTML output. Just switch modes before exporting (‘M-x bhl-mode’). BhlMode should automatically recognize the asterisks as marking sections and subsections. See EmacsOutlineToHtml for other alternatives.

org-publish.el (this comes in the latest version of org-mode) by DavidOtoole is a publishing management system for creating websites composed of all the files within a project (including OrgMode files, images, and source code, if desired).

new exporter/publish framework

Themes for HTML output

Obviously, default HTML output does not look nice at all. Here are some themes you can use:


If you’re using WindMove, CuaMode or MTorus (with default keybindings), you might want to disable the Org Mode keybindings for Shift+arrow keys:

    (setq org-replace-disputed-keys t)

(This need to be done before org.el is loaded, or requires a restart of Emacs to be effective.)

This will result in the following replacements:

If AllOut from Emacs 21 is loaded before org.el, you will be getting a Wrong type argument ((keymapp nil)) error. This was fixed in Emacs 22.

If you are forced to use Emacs 21, either install a newer version of allout.el, or make sure that org.el is loaded before allout.el. For example, use (require 'org) before requiring allout.

If you’re using session.el (EmacsSession), you need to excempt a circular data structure from saving:

    (add-to-list 'session-globals-exclude 'org-mark-ring)

If you’re using Emacs 23 and Org 7.5, then you can also have some pseudo-compatability while maintaining CUA support with Lisp:org-cua-dwim.el

External Data Sources

If you publish external sources to org mode agenda files, you’ll need to refresh those files after changes occur. Try this snippet to reload those files.

    (defun org-reload ()
      (switch-to-buffer "")
      (revert-buffer nil 1)
      (org-agenda nil "a")


Add-ons and other files

Related elisp code

Dragging URLs

This function uses org-mode support for plain list to facilitate dragging URLs from a webbrowser (or other apps) to an org-mode buffer:

(defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate)
  (if (eq major-mode 'org-mode)
	 ;; if this is the end of the line then just insert text here
	  (skip-chars-backward " \t")
	  (kill-region (point) (point-at-eol))
	  (unless (looking-back ":") (insert ":"))
	  (insert " "))

	 ;; if this is the beginning of the line then insert before
	 ((and (looking-at " \\|\t")
		 (skip-chars-backward " \t") (bolp)))
	  (looking-at "[ \t]*")
	  (open-line 1)
	  (indent-to (- (match-end 0) (match-beginning 0)))
	  (insert "+ "))

	 ;; if this is a middle of the line, then insert after
	  (newline t)
	  (insert "+ ")))
	(insert text)

Including all org files from a directory into the agenda

(setq org-agenda-files (file-expand-wildcards "~/org/*.org"))

Turn header lines into apparent visible separators

To make header lines more apparently visible in the buffer, set them a background color and change this part of ‘org-set-font-lock-defaults’, so that the header line is drawn across the screen:

	   ;; Headlines
	   '("^\\(\\**\\)\\(\\* \\)\\(.*\xa\\)" (1 (org-get-level-face 1))
	     (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))

The only change is the `\xa’ character is added before the last closing paren. This feature has been added to org-mode; see ‘org-fontify-whole-heading-line’.

Following Links

To follow links with RET, rather than a 2 key combo:

    (setq org-return-follows-link t)

You can also make TAB follow links in a similar way.

Opening pdf at specific page

To open links of type [~/test.pdf::3] i.e. open file at page 3:

    (delete '("\\.pdf\\'" . default) org-file-apps)
    (add-to-list 'org-file-apps '("\\.pdf::\\([0-9]+\\)\\'" . "evince \"%s\" -p %1"))

Opening pdf with alternative application

To open a link with a program other than the default(e.g. modify a pdf rather than read it):

(defun my-org-open-at-point()
  (let ((org-file-apps '(("\\.pdf\\'" . "xournal %s"))))

Sort a column in an Org Table

Org-Mode provide org-table-sort-lines C-c ^ to sort all the table lines based on a column. But sometime one need to sort just one column :

(defun org-table-sort-column ()
  "Sort table column at point."

  (let* ((thisline (org-current-line))
	 (thiscol (org-table-current-column))
	 (otc org-table-overlay-coordinates)
	 beg end bcol ecol tend tbeg column lns pos)
    (when (equal thiscol 0)
      (if (org-called-interactively-p 'any)
	  (setq thiscol
		 (read-string "Use column N for sorting: ")))
	(setq thiscol 1))
      (org-table-goto-column thiscol))
    (if (org-region-active-p)
	  (setq beg (region-beginning) end (region-end))
	  (goto-char beg)
	  (setq column (org-table-current-column)
		beg (point-at-bol))
	  (goto-char end)
	  (setq end (point-at-bol 2)))
      (setq column (org-table-current-column)
	    pos (point)
	    tbeg (org-table-begin)
	    tend (org-table-end))
      (if (re-search-backward org-table-hline-regexp tbeg t)
	  (setq beg (point-at-bol 2))
	(goto-char tbeg)
	(setq beg (point-at-bol 1)))
      (goto-char pos)
      (if (re-search-forward org-table-hline-regexp tend t)
	  (setq end (point-at-bol 1))
	(goto-char tend)
	(setq end (point-at-bol))))
    (setq beg (move-marker (make-marker) beg)
	  end (move-marker (make-marker) end))
    (untabify beg end)
    (goto-char beg)
    (org-table-goto-column column)
    (skip-chars-backward "^|")
    (setq bcol (point))
    (goto-char end)
    (org-table-goto-column column)
    (skip-chars-forward "^|")
    (setq ecol (point))
    (org-table-copy-region bcol ecol nil)
    (setq lns (mapcar (lambda (x) (cons 
				    (substring-no-properties x) )
		      ( mapcar 'car org-table-clip)))    
    (setq lns (org-do-sort lns "Column" ))

    (setq org-table-clip (mapcar 'list (mapcar 'cdr lns)))
    (goto-char beg)
    (org-table-goto-column column)
    (org-goto-line thisline)
    (org-table-goto-column thiscol)
    (when otc (org-table-toggle-coordinate-overlays))
    (message "%d element sorted in column %d" (length lns) column)))

Editing Wikipedia

Org Mode can be easily configured to help edit Wikipedia articles by changing outline-regexp in the mode hook:

(add-hook 'org-mode-hook '(lambda () (setq outline-regexp "=+")))

If you use WThreeM, add the following instead:

(setq w3m-form-textarea-edit-mode 'org-mode)
(add-hook 'w3m-form-input-textarea-mode-hook
          '(lambda nil
                   (setq outline-regexp "=+")))

Export UTF-8 checkboxes

This snippet turns - [X] into ☑ and - [ ] into ☐.

(defun sacha/org-html-checkbox (checkbox)
  "Format CHECKBOX into HTML."
  (case checkbox (on "<span class=\"check\">&#x2611;</span>") ; checkbox (checked)
	(off "<span class=\"checkbox\">&#x2610;</span>")
	(trans "<code>[-]</code>")
	(t "")))
(defadvice org-html-checkbox (around sacha activate)
  (setq ad-return-value (sacha/org-html-checkbox (ad-get-arg 0))))

Refile to opened orgmode buffer

The following codes allow refile to opened orgmode buffer files. (Currently set at level 1, to avoid too many refile targets when there are lots of orgmode files opened).

(defun ixp/org-buffer-files ()
  "Return list of opened orgmode buffer files"
  (mapcar (function buffer-file-name)
	  (org-buffer-list 'files)))

(setq org-refile-targets
      (quote ((nil :maxlevel . 3)
	      (ixp/org-buffer-files :maxlevel . 1)
	      (org-agenda-files :maxlevel . 3))))

Run org-todo at a specified date

The following code snippet allows you to run org-todo as though it had been executed at some prior time that is interactively selected using org-read-date. This is particularly useful if you use the org-habits module and you are late to file the completion of a habit. If you complete the habit with org-todo it will be completed for the current day, and scheduled to repeat at the next repeat interval based on the current date. If you use org-todo-at-date and set the appropriate date, the task will be scheduled to repeat as though the task had been completed on the specified date.

(defun org-todo-at-date (date)
  (interactive (list (org-time-string-to-time (org-read-date))))
  (cl-flet ((org-current-effective-time (&rest r) date)
         (org-today (&rest r) (time-to-days date)))


Discussion moved to Talk page


CategoryOutline CategoryPersonalInformationManager CategoryCalendar CategoryNeedsAttention CategoryWriting CategoryTables