From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Is there a save-outline-visibility excursion or so?
Date: Fri, 24 May 2013 16:06:19 +0200 [thread overview]
Message-ID: <87zjvkbhgk.fsf@gmail.com> (raw)
In-Reply-To: jwvwqqpj1ct.fsf-monnier+gmane.emacs.help@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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).
Thanks for the tips.
I found out that a similar library already existed (org-weights.el by
Francois Pinard) which is based of overlays. So I forked his code and
merged my code/ideas into it. Its still a bit buggy, but here are a few
examples of what this (extended) library can do now (I posted this
already on the Org-mode list). Don't bother about the numbers, they are
made up, since I cannot copy overlays:
1. Org-mode/subtree-weights:
,-----------------------------------------------
| * Header 1 * 2 + 1...
| ** Header 2a ** 1
|
| text text text text text
| text text text text text
|
| ** Header 2b ** 1
`-----------------------------------------------
2. Outshine Emacs Lisp/subtree-weights:
,--------------------------------------------------
| ;; * Header 1 * 2 + 1...
| ;; ** Header 2a ** 1
|
| text text text text text
| text text text text text
|
| ;; ** Header 2b ** 1
|
`--------------------------------------------------
3. Conventional Emacs-Lisp/hidden-lines-cookies
,--------------------------------
| ;;; Header 1 [#1]
| ;;;; Header 2a [#4]
|
| text text text text text
| text text text text text
|
| ;;;; Header 2b [#2]
|
`--------------------------------
4. Outshine PicoLisp/hidden-lines-cookies
,--------------------------------
| ## * Header 1 [#1]
| ## ** Header 2a [#4]
|
| text text text text text
| text text text text text
|
| ## ** Header 2b [#2]
|
`--------------------------------
The original repo is at:
,--------------------------------------
| https://github.com/pinard/org-weights
`--------------------------------------
you can find my fork with the extended version here:
,------------------------------------
| https://github.com/tj64/org-weights
`------------------------------------
--
cheers,
Thorsten
prev parent reply other threads:[~2013-05-24 14:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-22 9:13 Is there a save-outline-visibility excursion or so? Thorsten Jolitz
2013-05-22 9:18 ` Jambunathan K
2013-05-22 10:12 ` Thorsten Jolitz
2013-05-22 10:25 ` Thorsten Jolitz
2013-05-22 12:39 ` Jambunathan K
2013-05-22 13:41 ` Thorsten Jolitz
2013-05-23 1:05 ` Stefan Monnier
2013-05-23 10:43 ` Thorsten Jolitz
2013-05-23 13:09 ` Stefan Monnier
2013-05-24 14:06 ` Thorsten Jolitz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zjvkbhgk.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).