GNU bug report logs -
#52980
elide-head and revert-buffer interaction stops elide-head-show from working
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Mon, 3 Jan 2022 16:49:02 UTC
Severity: normal
Tags: patch
Fixed in version 29.1
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
Full log
Message #16 received at 52980 <at> debbugs.gnu.org (full text, mbox):
Just one minor suggestion from me:
Stefan Kangas <stefan <at> marxist.se> writes:
> tags 52980 + patch
> thanks
>
> Stefan Kangas <stefan <at> 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.
This bug report was last modified 3 years and 191 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.