I work with org-mode TODO lists not in org-agenda mode, but within the actual .org files, marking TODO headings DONE as I go.
* DONE buy milk * TODO fix car * STARTED call mom I want org to move point to the next TODO heading once I mark it as DONE. But not before, i.e. when I mark a TODO heading as STARTED, I want point to stay on that heading:
(setq org-todo-keywords '( (sequence "TODO" "STARTED" "|" "DONE") How do I get org to move point to next TODO heading upon state change to DONE?
I tried this...
(add-hook 'org-after-todo-state-change-hook (lambda () (org-next-visible-heading 1)) ) ...but it doesn't work because the hook is executed within a save-excursion block.
I tried this...
(defun bb/next-heading (&rest args) (org-next-visible-heading 1)) (advice-add 'org-todo :after 'bb/next-heading) ...which works, but triggers upon ANY state change. How do I make it so org-next-visible-heading gets triggered ONLY when a TODO heading is marked DONE?
(when (org-entry-is-done-p) (outline-next-visible-heading 1))or the more specific(when (string= (org-get-todo-state) "DONE") (outline-next-visible-heading 1)).bb/next-headingdefun:(defun bb/next-heading (&rest args) (when (org-entry-is-done-p) (outline-next-visible-heading 1)))