Using GTD with org-mode

This is a simple setup I use to run GTD org-mode in emacs. I use syncthing to keep this folder synced through my computers.


(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)

(setq org-agenda-files '("~/Sync/orgs/gtd/"

(setq org-capture-templates '(("t" "Todo [inbox]" entry
                               (file+headline "~/Sync/orgs/gtd/" "Tasks")
                               "* TODO %i%?")
                              ("T" "Tickler" entry
                               (file+headline "~/Sync/orgs/gtd/" "Tickler")
                               "* %i%? \n %U")))

(setq org-refile-targets '(("~/Sync/orgs/gtd/" :maxlevel . 3)
                           ("~/Sync/orgs/gtd/" :level . 1)
                           ("~/Sync/orgs/gtd/" :maxlevel . 2)))

(setq org-todo-keywords '((sequence "TODO(t)" "WAITING(w)" "|" "DONE(d)" "CANCELLED(c)")))

(setq org-agenda-custom-commands 
      '(("o" "At the office" tags-todo "@office"
         ((org-agenda-overriding-header "Office")))))

(setq org-agenda-custom-commands 
      '(("o" "At the office" tags-todo "@office"
         ((org-agenda-overriding-header "Office")
          (org-agenda-skip-function #'my-org-agenda-skip-all-siblings-but-first)))))

(defun my-org-agenda-skip-all-siblings-but-first ()
  "Skip all but the first non-done entry."
  (let (should-skip-entry)
    (unless (org-current-is-todo)
      (setq should-skip-entry t))
      (while (and (not should-skip-entry) (org-goto-sibling t))
        (when (org-current-is-todo)
          (setq should-skip-entry t))))
    (when should-skip-entry
      (or (outline-next-heading)
          (goto-char (point-max))))))
(defun org-current-is-todo ()
  (string= "TODO" (org-get-todo-state)))

Command Cheatsheet

Action Command
Capture C-c c
Refile C-c C-w
Tagging C-c C-c
TODO keyword switching C-c C-t
Agenda C-c a