Is there any way to modify node visibility and then revert those changes? In particular I'm interested in doing and then reverting (org-content).

What follows is more details at what I'm trying to accomplish in the end.

Let's say we have nodes:
* A
** B
*** TODO ะก
For task node C I want to see which parent node has tag "project" and then put it into a prefix in agenda. Here's my code:
===
(defun org-get-task-project ()
  (let ((project ""))
    (save-excursion
      (org-content)
      (while
          (progn
            (ignore-errors (outline-up-heading 1))
            (when (and (eq project "")
                       (member "project" (org-get-tags-at (point) t)))
              (setq project (nth 4 (org-heading-components))))
            (> (nth 1 (org-heading-components)) 1))))
    project))

(with-eval-after-load 'org-agenda
  (add-to-list 'org-agenda-prefix-format
               '(todo . " %i %?-20(org-get-task-project)")))
===
In the code above we have to make all headings visible first with org-content because outline-up-heading works only on visible nodes.

--
Best Regards,
Nikolay Kudryavtsev


Reply via email to