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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52980 in the body.
You can then email your comments to 52980 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52980
; Package
emacs
.
(Mon, 03 Jan 2022 16:49:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Kangas <stefan <at> marxist.se>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 03 Jan 2022 16:49:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
On current master:
0. emacs -Q lisp/help.el
;; Any file where the header would normally be elided
1. M-x elide-head RET
2. M-x revert-buffer RET
3. M-: elide-head-overlay RET => nil
;; Note that the overlay is still in the buffer though.
4. M-x elide-head RET
;; A second overlay is added.
5. M-x elide-head-show RET
Now I see no license, as only the second overlay is removed.
Note that the above sequence of commands should be equivalent to what
happens when you revert the buffer if you have added `elide-head' to a
major mode hook, as in:
(add-hook 'prog-mode-hook 'elide-head)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52980
; Package
emacs
.
(Mon, 03 Jan 2022 18:41:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 52980 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> 0. emacs -Q lisp/help.el
> ;; Any file where the header would normally be elided
> 1. M-x elide-head RET
> 2. M-x revert-buffer RET
> 3. M-: elide-head-overlay RET => nil
> ;; Note that the overlay is still in the buffer though.
> 4. M-x elide-head RET
> ;; A second overlay is added.
> 5. M-x elide-head-show RET
>
> Now I see no license, as only the second overlay is removed.
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52980
; Package
emacs
.
(Tue, 04 Jan 2022 08:16:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 52980 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.
[0001-New-minor-mode-elide-head-mode.patch (text/x-diff, attachment)]
Added tag(s) patch.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Tue, 04 Jan 2022 08:16:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52980
; Package
emacs
.
(Tue, 04 Jan 2022 17:03:01 GMT)
Full text and
rfc822 format available.
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52980
; Package
emacs
.
(Wed, 05 Jan 2022 09:31:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 52980 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
<jakanakaevangeli <at> chiru.no> writes:
>> + (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.
I think you're right, thanks! Updated patch attached.
[0001-New-minor-mode-elide-head-mode.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52980
; Package
emacs
.
(Sun, 09 Jan 2022 10:14:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 52980 <at> debbugs.gnu.org (full text, mbox):
close 52980 29.1
thanks
No further comments within 4 days; pushed to master as commit
262a7c9ea0.
bug marked as fixed in version 29.1, send any further explanations to
52980 <at> debbugs.gnu.org and Stefan Kangas <stefan <at> marxist.se>
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sun, 09 Jan 2022 10:14:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 06 Feb 2022 12:24:07 GMT)
Full text and
rfc822 format available.
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.