GNU bug report logs - #77370
[PATCH] Improve foldout-exit-fold behavior with negative argument

Previous Next

Package: emacs;

Reported by: "Paul D. Nelson" <ultrono <at> gmail.com>

Date: Sat, 29 Mar 2025 21:07:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: "Paul D. Nelson" <ultrono <at> gmail.com>
To: 77370 <at> debbugs.gnu.org
Subject: bug#77370: [PATCH] Improve foldout-exit-fold behavior with negative argument
Date: Sat, 29 Mar 2025 22:06:40 +0100
[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)]

This bug report was last modified 102 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.