GNU bug report logs -
#77370
[PATCH] Improve foldout-exit-fold behavior with negative argument
Previous Next
Reported by: "Paul D. Nelson" <ultrono <at> gmail.com>
Date: Sat, 29 Mar 2025 21:07:02 UTC
Severity: normal
Tags: patch
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
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 77370 in the body.
You can then email your comments to 77370 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#77370; Package
emacs.
(Sat, 29 Mar 2025 21:07:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Paul D. Nelson" <ultrono <at> gmail.com>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Sat, 29 Mar 2025 21:07:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
The foldout-* commands, available in outline-minor-mode, give a way to
zoom in and out of "folds", which are subtrees defined by the outline
structure. To follow along with this email, start by doing
foldout-zoom-subtree (C-c @ C-z) on a subtree (e.g., an elisp defun).
By default, foldout-exit-fold (C-c @ C-x) exits one fold, hides the text
that was in that fold (outline-hide-subtree), moves point to the
heading, and recenters. When invoked with a negative prefix argument
like C-- C-c @ C-x, the command instead
(1) exits one fold without hiding the text,
(2) moves point to the bottom of the fold, and
(3) recenters.
I think that better behavior would be to skip steps (2) and (3), so that
the point stays put and the window view does not change.
[Step (2) seems incidental rather than by design, so "skip" really means
"counter".]
Advantages of omitting (2) are:
- We don't lose our place when zooming out.
- If we zoom in and zoom out (C-c @ C-z, C-- C-c @ C-x), then point
doesn't move.
- Consistency with other outline/foldout commands that preserve "point
being on a heading".
Regarding (3), recentering helps us reorient when hiding an exited fold,
but is disruptive when the text remains visible.
We retain the flexibility to imitate the old behavior using M-> and C-l.
The change could be guarded by a defcustom, but it seems to me like a
clear improvement. I'd be happy to learn if I missed some scenario
where it is not.
Any feedback would be welcome.
[0001-Improve-foldout-exit-fold-with-negative-arg.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#77370; Package
emacs.
(Thu, 13 Nov 2025 05:55:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 77370 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I thought I'd gently ping on this. To summarize, when exiting a fold with
a negative argument (to keep the text visible), Emacs currently moves point
to the end of the fold and recenters. As far as I can tell, this behavior
is an oversight rather than intentional: the recentering is helpful when
hiding text (to reorient), but disruptive when keeping text visible.
The patch preserves point and skips recentering when the fold is kept
visible. I'd be happy to resubmit as a user option if there are concerns
about changing default behavior, though that seems like overkill for what
appears to be a bug fix.
On Sat, Mar 29, 2025 at 10:07 PM Paul D. Nelson <ultrono <at> gmail.com> wrote:
> The foldout-* commands, available in outline-minor-mode, give a way to
> zoom in and out of "folds", which are subtrees defined by the outline
> structure. To follow along with this email, start by doing
> foldout-zoom-subtree (C-c @ C-z) on a subtree (e.g., an elisp defun).
>
> By default, foldout-exit-fold (C-c @ C-x) exits one fold, hides the text
> that was in that fold (outline-hide-subtree), moves point to the
> heading, and recenters. When invoked with a negative prefix argument
> like C-- C-c @ C-x, the command instead
>
> (1) exits one fold without hiding the text,
>
> (2) moves point to the bottom of the fold, and
>
> (3) recenters.
>
> I think that better behavior would be to skip steps (2) and (3), so that
> the point stays put and the window view does not change.
>
> [Step (2) seems incidental rather than by design, so "skip" really means
> "counter".]
>
> Advantages of omitting (2) are:
>
> - We don't lose our place when zooming out.
>
> - If we zoom in and zoom out (C-c @ C-z, C-- C-c @ C-x), then point
> doesn't move.
>
> - Consistency with other outline/foldout commands that preserve "point
> being on a heading".
>
> Regarding (3), recentering helps us reorient when hiding an exited fold,
> but is disruptive when the text remains visible.
>
> We retain the flexibility to imitate the old behavior using M-> and C-l.
>
> The change could be guarded by a defcustom, but it seems to me like a
> clear improvement. I'd be happy to learn if I missed some scenario
> where it is not.
>
> Any feedback would be welcome.
>
>
[Message part 2 (text/html, inline)]
[0001-Improve-foldout-exit-fold-with-negative-arg.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#77370; Package
emacs.
(Sat, 15 Nov 2025 10:33:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 77370 <at> debbugs.gnu.org (full text, mbox):
> From: Paul Nelson <ultrono <at> gmail.com>
> Date: Thu, 13 Nov 2025 06:53:52 +0100
>
> I thought I'd gently ping on this. To summarize, when exiting a fold with a negative argument (to keep the
> text visible), Emacs currently moves point to the end of the fold and recenters. As far as I can tell, this
> behavior is an oversight rather than intentional: the recentering is helpful when hiding text (to reorient), but
> disruptive when keeping text visible.
>
> The patch preserves point and skips recentering when the fold is kept visible. I'd be happy to resubmit as a
> user option if there are concerns about changing default behavior, though that seems like overkill for what
> appears to be a bug fix.
Thanks.
Juri, any comments? The patch looks like a no-brainer to me.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#77370; Package
emacs.
(Sat, 15 Nov 2025 17:18:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 77370 <at> debbugs.gnu.org (full text, mbox):
close 77370 31.0.50
thanks
>> I thought I'd gently ping on this. To summarize, when exiting a fold with a negative argument (to keep the
>> text visible), Emacs currently moves point to the end of the fold and recenters. As far as I can tell, this
>> behavior is an oversight rather than intentional: the recentering is helpful when hiding text (to reorient), but
>> disruptive when keeping text visible.
>>
>> The patch preserves point and skips recentering when the fold is kept visible. I'd be happy to resubmit as a
>> user option if there are concerns about changing default behavior, though that seems like overkill for what
>> appears to be a bug fix.
>
> Thanks.
>
> Juri, any comments? The patch looks like a no-brainer to me.
Everything looks correct, so now pushed. Thanks Paul for the patch.
bug marked as fixed in version 31.0.50, send any further explanations to
77370 <at> debbugs.gnu.org and "Paul D. Nelson" <ultrono <at> gmail.com>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org.
(Sat, 15 Nov 2025 17:18: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, 14 Dec 2025 12:24:34 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.