emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Keeping outline after reverting buffer
@ 2018-01-15 13:49 Roland Fehrenbacher
  2018-01-19 17:43 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Roland Fehrenbacher @ 2018-01-15 13:49 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

is there any option or other customization to keep the outline of an org
buffer (uncollapsed parts of the tree) after the buffer has been
reverted (org-mode 9.0.1, emacs 25.3.2)? In my case only the top
headings are displayed after reverting. This is quite annoying and
time-consuming in a setup, where one constantly switches between git
branches e.g.

Thanks,

Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Keeping outline after reverting buffer
  2018-01-15 13:49 Keeping outline after reverting buffer Roland Fehrenbacher
@ 2018-01-19 17:43 ` Nicolas Goaziou
  2018-01-20 11:38   ` Roland Fehrenbacher
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2018-01-19 17:43 UTC (permalink / raw)
  To: Roland Fehrenbacher; +Cc: emacs-orgmode

Hello,

Roland Fehrenbacher <rf@q-leap.de> writes:

> is there any option or other customization to keep the outline of an org
> buffer (uncollapsed parts of the tree) after the buffer has been
> reverted (org-mode 9.0.1, emacs 25.3.2)? In my case only the top
> headings are displayed after reverting. This is quite annoying and
> time-consuming in a setup, where one constantly switches between git
> branches e.g.

Org provides two functions to save and restore visibility (and a macro
that does both, but isn't useful in your case):
`org-outline-overlay-data' and `org-set-outline-overlay-data'.

You may want to use them within `before-revert-hook' and
`after-revert-hook'.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Keeping outline after reverting buffer
  2018-01-19 17:43 ` Nicolas Goaziou
@ 2018-01-20 11:38   ` Roland Fehrenbacher
  0 siblings, 0 replies; 3+ messages in thread
From: Roland Fehrenbacher @ 2018-01-20 11:38 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hi Nicolas,

>>>>> "N" == Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

    N> Hello, Roland Fehrenbacher <rf@q-leap.de> writes:

    >> is there any option or other customization to keep the outline of
    >> an org buffer (uncollapsed parts of the tree) after the buffer
    >> has been reverted (org-mode 9.0.1, emacs 25.3.2)? In my case only
    >> the top headings are displayed after reverting. This is quite
    >> annoying and time-consuming in a setup, where one constantly
    >> switches between git branches e.g.

    N> Org provides two functions to save and restore visibility (and a
    N> macro that does both, but isn't useful in your case):
    N> `org-outline-overlay-data' and `org-set-outline-overlay-data'.

    N> You may want to use them within `before-revert-hook' and
    N> `after-revert-hook'.

this was spot on, Thanks a lot. The following link

https://stackoverflow.com/questions/6666862/org-mode-go-back-from-sparse-tree-to-previous-visibility/44158824#44158824

had a ready-to-use implementation for this. Excellent, makes life a lot
easier :)

Best,

Roland

-------
http://www.q-leap.com / http://qlustar.com
          --- HPC / Storage / Cloud Linux Cluster OS ---

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-20 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 13:49 Keeping outline after reverting buffer Roland Fehrenbacher
2018-01-19 17:43 ` Nicolas Goaziou
2018-01-20 11:38   ` Roland Fehrenbacher

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).