1

I'm writing a paper where TODO entries are mixed in along with the headings of the paper. I can look at all my TODO entries with C-c / t (or C-c / T for specific keywords).

Is there a way to show all headings except the TODO entries? I'd like to get a clean look of the document structure without these headings.

  • Maybe you can profit from inline tasks. Related question here. – Juancho Jun 6 '18 at 14:36
  • 2
    C-c / m TODO="" should work but my org-sparse-tree fu is weak: I don't get the result I expect, but I don't get the result I expect with C-c / t either. I'm probably doing something wrong. – NickD Jun 6 '18 at 17:37
  • Bowing before @Nick's org-sparse-tree fu. More details can be found in the org info documentation: (org) Matching tags and properties. – Marco Wahl Jun 7 '18 at 8:11
0

I think the sparse tree type you are interested in is not build into Org mode.

Core of your issue is to decide whether a headline is contained in a todo subtree or not IIUC. You could use the following function for that.

(defun org-todo-subtree-p ()
  "Return non-nil if in or below a todo subtree else return nil.
Only works on headlines."
  (save-excursion
    (cl-labels ((internal-subheading-todo-p
                 ()
                 (let ((el (org-element-at-point)))
                   (assert (eq (car el) 'headline))
                   (or (plist-get (cadr el) :todo-keyword)
                       (when (< 1 (plist-get (cadr el) :level))
                         (org-up-heading-all 1)
                         (internal-subheading-todo-p))))))
    (internal-subheading-todo-p))))

Build the tree with the org-occur function which fortunately allows to specify a callback for specifying the wanted.

(defun org-show-non-todo-tree ()
  "Make a tree with headlines not in any todo subtree."
  (interactive)
  (org-occur (concat "^" org-outline-regexp " *"  ) nil (lambda () (not (org-todo-subtree-p)))))

Activate the command with M-x org-show-non-todo-tree .

I guess that's it. But no guarantees, as always.

0

I think you are looking for projects that have no next action assigned and thus are stuck. There is some builtin functionality for that in org mode that you might be interested in: https://orgmode.org/manual/Stuck-projects.html. Briefly:

A stuck project is a project that has no defined next actions, so it will never show up in the TODO lists Org mode produces. During the review, you need to identify such projects and define next actions for them.

C-c a #     (org-agenda-list-stuck-projects)

     List projects that are stuck. 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.