Skip next steps in org todo lists

Projects can fill up the task list quite easily, though actually only
the immediately next task is of real interest.
This commit is contained in:
Tom Willemse 2015-05-25 19:26:51 +02:00
parent d25cc62263
commit 3eb9eb45f3

View file

@ -82,16 +82,31 @@
(setq outline-path (concat "[ " outline-path " ] "))) (setq outline-path (concat "[ " outline-path " ] ")))
outline-path)) outline-path))
(defun oni:org-heading-has-predecessor-p ()
"Determine if a heading has a predecessor.
Only tasks of a level greater than 3 are considered. A task has a
predecessor if there is a non-DONE sibling defined before it."
(let ((point (point)))
(save-excursion
(org-backward-heading-same-level 1)
(let ((components (org-heading-components)))
(not (or (< (car components) 3)
(= point (point))
(member (elt components 2) org-done-keywords)))))))
(defun oni:next-heading-position ()
(or (ignore-errors (org-forward-element)
(point))
(point-max)))
(defun org-init-skip-tags () (defun org-init-skip-tags ()
"Skip the \"ex\" and \"unconfirmed\" tags." "Skip the \"ex\" and \"unconfirmed\" tags."
(let ((tags (org-get-tags-at (point)))) (let ((tags (org-get-tags-at (point))))
(when (or (member "ex" tags) (when (or (member "ex" tags)
(member "unconfirmed" tags)) (member "unconfirmed" tags)
(save-excursion (oni:org-heading-has-predecessor-p))
(or (oni:next-heading-position))))
(ignore-errors (org-forward-element)
(point))
(point-max))))))
(defun org-init-get-tag-name () (defun org-init-get-tag-name ()
"Get the name for a new tag for the currently loaded desktop." "Get the name for a new tag for the currently loaded desktop."