summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2015-05-25 19:26:51 +0200
committerGravatar Tom Willemse2015-05-25 19:26:51 +0200
commit3eb9eb45f32ad978e128f04c3911eb43af9b161c (patch)
tree1535869965b195d423a5e94888cc55eeddd2930c
parentd25cc62263beb8a87f4df6b41f57aa9876c91a72 (diff)
downloaddotfiles-3eb9eb45f32ad978e128f04c3911eb43af9b161c.tar.gz
dotfiles-3eb9eb45f32ad978e128f04c3911eb43af9b161c.zip
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.
-rw-r--r--emacs/.emacs.d/site-lisp/org-init.el27
1 files changed, 21 insertions, 6 deletions
diff --git a/emacs/.emacs.d/site-lisp/org-init.el b/emacs/.emacs.d/site-lisp/org-init.el
index ac2b3cc..edfc3e1 100644
--- a/emacs/.emacs.d/site-lisp/org-init.el
+++ b/emacs/.emacs.d/site-lisp/org-init.el
@@ -82,16 +82,31 @@
(setq outline-path (concat "[ " 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 ()
"Skip the \"ex\" and \"unconfirmed\" tags."
(let ((tags (org-get-tags-at (point))))
(when (or (member "ex" tags)
- (member "unconfirmed" tags))
- (save-excursion
- (or
- (ignore-errors (org-forward-element)
- (point))
- (point-max))))))
+ (member "unconfirmed" tags)
+ (oni:org-heading-has-predecessor-p))
+ (oni:next-heading-position))))
(defun org-init-get-tag-name ()
"Get the name for a new tag for the currently loaded desktop."