Emacs Org: Task-related keyboard shortcuts for the agenda
| emacs, orgI really love the way you can tweak Emacs’ keyboard shortcuts and functionality to fit the way you want to work. Here are three keyboard shortcuts I’ve added to my Org agenda to make it even easier to work with tasks.
x
: Mark the current task as done. Same as typing t x
, but somehow it feels like it has more oomph as a single-character shortcut.
X
: Mark the current task as done and create a new task at the same level, taking advantage of the task template I’d previously created in org-capture-templates
.
N
: Create a new note or task at the current position.
Make it easy to mark a task as done
(defun sacha/org-agenda-done (&optional arg) "Mark current TODO as done. This changes the line at point, all other lines in the agenda referring to the same tree node, and the headline of the tree node in the Org-mode file." (interactive "P") (org-agenda-todo "DONE")) ;; Override the key definition for org-exit (define-key org-agenda-mode-map "x" 'sacha/org-agenda-done)
Make it easy to mark a task as done and create a follow-up task
(defun sacha/org-agenda-mark-done-and-add-followup () "Mark the current TODO as done and add another task after it. Creates it at the same level as the previous task, so it's better to use this with to-do items than with projects or headings." (interactive) (org-agenda-todo "DONE") (org-agenda-switch-to) (org-capture 0 "t")) ;; Override the key definition (define-key org-agenda-mode-map "X" 'sacha/org-agenda-mark-done-and-add-followup)
Capture something based on the agenda position
(defun sacha/org-agenda-new () "Create a new note or task at the current agenda item. Creates it at the same level as the previous task, so it's better to use this with to-do items than with projects or headings." (interactive) (org-agenda-switch-to) (org-capture 0)) ;; New key assignment (define-key org-agenda-mode-map "N" 'sacha/org-agenda-new)
Check out my Emacs configuration for other ideas.
5 comments
olberger
2013-01-16T20:59:47ZBtw, I've juste discovered the 'k c' agenda view action that allows you to capture SCHEDULED tasks right from the agenda. See more details at http://www.olivierberger.co...
Thanks for your post, that triggered my curiosity to try and search for a way to schedule todos from the agenda ;)
Friedel
2013-01-17T14:16:37ZThis just inspired me to add
("x" org-todo "DONE")
to org-speed-commands-user
Ury Marshak
2013-02-06T11:07:56ZIt's useful to have a quick link in a task to the one it's based on. So
for marking as done and creating a follow-up I use the following:(defun mark-done-and-open-new-linked () (interactive) (org-todo 'done) (org-add-log-note) (org-capture nil "l"))Where in org-capture-templates there is a corresponding entry:("l" "Todo + link" entry (file+headline ,org-default-capture-file "Tasks")
"* TODO %?%i %^g\n Ref:%a\n Added:%U"
:prepend t)This way the new task has a link that can be quickly followed to original. Now it's a nice idea to make it work in the agenda as per your sacha/org-agenda-mark-done-and-add-followup
Emmanuel Goldstein
2017-09-01T10:26:03ZActually, x does not work anymore. I seem to have to cycle when in Agenda (by pressing t several times) to all todo statuses until I reach DONE. Before there was a way to just press t (with several options) and then d for DONE. Is this not possible anymore? Thanks.
sachac
2017-09-07T15:15:57ZHmm, have you set up shortcuts in your org-todo-keywords ? Ex: ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(x!)" "CANCELLED(c@)")) - the shortcuts are the characters in the parentheses. You may also need to enable org-use-fast-todo-selection if you haven't yet.