From: <jakanakaevangeli@chiru.no>
To: Stefan Kangas <stefan@marxist.se>, 52980@debbugs.gnu.org
Subject: bug#52980: elide-head and revert-buffer interaction stops elide-head-show from working
Date: Tue, 04 Jan 2022 18:08:37 +0100 [thread overview]
Message-ID: <87v8yzsa22.fsf@miha-pc> (raw)
In-Reply-To: <CADwFkmkox1EC3NXR27PokCQ+eTRr4UVFBwypOw7UR6_z4OmYKQ@mail.gmail.com>
Just one minor suggestion from me:
Stefan Kangas <stefan@marxist.se> writes:
> tags 52980 + patch
> thanks
>
> Stefan Kangas <stefan@marxist.se> writes:
>
>> I started looking into a solution with {before,after}-revert-hook, but
>> that just seems duplicate what we would get from just using a minor
>> mode. So I'm starting to think that `elide-head' and `elide-head-show'
>> should be obsoleted in favor of a new local minor mode
>> `elide-head-mode'.
>>
>> That would also save me from having to add a third command
>> `elide-head-toggle' to toggle the hiding on or off.
>
> Here's a patch.
> [...]
>
> +;;;###autoload
> +(define-minor-mode elide-head-mode
> + "Toggle eliding (hiding) header material in the current buffer.
> +
> +When Elide Header mode is enabled, headers are hidden according
> +to `elide-head-headers-to-hide'.
> +
> +This is suitable as an entry on `find-file-hook' or appropriate
> +mode hooks."
> + :group 'elide-head
> + (if elide-head-mode
> + (progn
> + (elide-head--hide)
> + (add-hook 'before-revert-hook 'elide-head--delete-overlay nil 'local))
> + (elide-head--show)
> + (remove-hook 'before-revert-hook 'elide-head--delete-overlay 'local)))
Perhaps change-major-mode-hook would be more appropriate as suggested by
"(elisp) Creating Buffer-Local". That would make the minor mode clean up
its overlay if the user executes M-x normal-mode in addition to M-x
revert-buffer.
> [...]
Best regards.
next prev parent reply other threads:[~2022-01-04 17:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-03 16:48 bug#52980: elide-head and revert-buffer interaction stops elide-head-show from working Stefan Kangas
2022-01-03 18:40 ` Stefan Kangas
2022-01-04 8:15 ` Stefan Kangas
2022-01-04 17:08 ` jakanakaevangeli [this message]
2022-01-05 9:30 ` Stefan Kangas
2022-01-09 10:13 ` Stefan Kangas
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v8yzsa22.fsf@miha-pc \
--to=jakanakaevangeli@chiru.no \
--cc=52980@debbugs.gnu.org \
--cc=stefan@marxist.se \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.