1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Improve foldout-exit-fold with negative arg (bug#77370)

* lisp/foldout.el (foldout-exit-fold): When called with a
negative prefix argument (so that the exited fold is not
hidden), preserve the position of point and do not recenter.
This commit is contained in:
Paul Nelson 2025-03-29 19:07:13 +01:00 committed by Juri Linkov
parent c9372ced9c
commit a0761ddb4b
2 changed files with 11 additions and 3 deletions

View file

@ -290,10 +290,10 @@ optional arg EXPOSURE \(interactively with prefix arg) changes this:-
"Return to the ARG'th enclosing fold view. With ARG = 0 exit all folds.
Normally causes exited folds to be hidden, but with ARG < 0, -ARG folds are
exited and text is left visible."
exited, text is left visible, and point position is preserved."
(interactive "p")
(let ((hide-fold t) start-marker end-marker
beginning-of-heading end-of-subtree)
beginning-of-heading end-of-subtree (original-point (point)))
;; check there are some folds to leave
(if (null foldout-fold-list)
@ -369,7 +369,10 @@ exited and text is left visible."
(if end-marker
(1- (marker-position end-marker))
(point-max)))))
(recenter)
(if hide-fold
(recenter)
(goto-char original-point))
;; update the mode line
(foldout-update-mode-line)))