[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a save-outline-visibility excursion or so?
From: |
Stefan Monnier |
Subject: |
Re: Is there a save-outline-visibility excursion or so? |
Date: |
Thu, 23 May 2013 09:09:13 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> A hidden-line-cookie is only written, if the headline is folded, and
> deleted if it is expanded. This is done by
> 'org-hlc-write-hidden-lines-cookies'. Thus to delete all cookies, I
> temporarily expand all subtrees, call the function, and then go back to
> the former visibility state and point position.
It would seem like it would be a lot simpler to write a loop that simply
erases your "cookies" without paying attention to the visibility state.
"do and then undo" is always a high-risk way to do nothing, so if you
can really do nothing instead, it's always a major reliability gain.
Your use of an indirect buffer luckily saves you from having to "do and
undo". But indirect buffers suck.
BTW, rather than "insert" your cookies in the text (which has lots of
undesirable side effects, such as being visible in the saved file), why
not use overlays (in which case org-hlc-hide-hidden-lines-cookies would
just be a single call to remove-overlays).
Stefan