]> git.donarmstrong.com Git - lib.git/commitdiff
add back is-project-p
authorDon Armstrong <don@donarmstrong.com>
Wed, 6 Dec 2017 19:38:55 +0000 (11:38 -0800)
committerDon Armstrong <don@donarmstrong.com>
Wed, 6 Dec 2017 19:38:55 +0000 (11:38 -0800)
emacs_el/configuration/don-configuration.org

index 5b84028e2c55419632e36ebf43c244e5348aa5bf..9feb84b0cfe744f80938a529c6266ba0bbea8e11 100644 (file)
@@ -1316,6 +1316,21 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
             (when (member (org-get-todo-state) org-todo-keywords-1)
               (setq has-subtask t))))
         (and is-a-task (not has-subtask)))))
+  (defun bh/is-project-p ()
+    "Any task with a todo keyword subtask"
+    (save-restriction
+      (widen)
+      (let ((has-subtask)
+            (subtree-end (save-excursion (org-end-of-subtree t)))
+            (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
+        (save-excursion
+          (forward-line 1)
+          (while (and (not has-subtask)
+                      (< (point) subtree-end)
+                      (re-search-forward "^\*+ " subtree-end t))
+            (when (member (org-get-todo-state) org-todo-keywords-1)
+              (setq has-subtask t))))
+        (and is-a-task has-subtask))))
 
   (defun bh/is-subproject-p ()
     "Any task which is a subtask of another project"