emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Save-excursion that works with org visibility?


From: John Kitchin
Subject: Re: [O] Save-excursion that works with org visibility?
Date: Sun, 14 May 2017 08:16:37 -0400
User-agent: mu4e 0.9.19; emacs 25.1.1

Is org-save-outline-visibility  what you are looking for?

Nikolay Kudryavtsev writes:

> 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.


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]