aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/text.texi8
-rw-r--r--etc/NEWS7
-rw-r--r--lisp/foldout.el15
3 files changed, 30 insertions, 0 deletions
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 9bc2a6407d5..a6d19a32bc5 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -1396,6 +1396,14 @@ exits all folds.
1396subheadings, specify a negative argument. For example, @w{@kbd{M--2 C-c 1396subheadings, specify a negative argument. For example, @w{@kbd{M--2 C-c
1397C-x}} exits two folds and leaves the text and subheadings exposed. 1397C-x}} exits two folds and leaves the text and subheadings exposed.
1398 1398
1399@findex foldout-widen-to-current-fold
1400 While working within a fold, you may wish to use Emacs's standard
1401narrowing commands such as @kbd{C-x n n} (@code{narrow-to-region}) or
1402@kbd{C-x n d} (@code{narrow-to-defun}). After using these commands,
1403@code{foldout-widen-to-current-fold}) allows you to widen back to the
1404current fold level, rather than the entire buffer. If you're not
1405currently in a fold, it behaves like @code{widen}.
1406
1399 Foldout mode also provides mouse commands for entering and exiting 1407 Foldout mode also provides mouse commands for entering and exiting
1400folds, and for showing and hiding text: 1408folds, and for showing and hiding text:
1401 1409
diff --git a/etc/NEWS b/etc/NEWS
index c2919169bbf..daaae54d7d3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -535,6 +535,13 @@ instead.
535*** A new shortcut to navigate to previous menu. 535*** A new shortcut to navigate to previous menu.
536The hardcoded "^" shortcut gets you back to the previous menu. 536The hardcoded "^" shortcut gets you back to the previous menu.
537 537
538** Foldout
539
540---
541*** New command 'foldout-widen-to-current-fold'.
542This command widens the view to the current fold level when in a fold,
543or behaves like 'widen' if not in a fold.
544
538 545
539* New Modes and Packages in Emacs 31.1 546* New Modes and Packages in Emacs 31.1
540 547
diff --git a/lisp/foldout.el b/lisp/foldout.el
index 5799318fc6f..a4b6a402c5c 100644
--- a/lisp/foldout.el
+++ b/lisp/foldout.el
@@ -490,6 +490,21 @@ Signal an error if the event didn't occur on a heading."
490 (error "Not a heading line"))) 490 (error "Not a heading line")))
491 491
492 492
493(defun foldout-widen-to-current-fold ()
494 "Widen to the current fold level.
495If in a fold, widen to that fold's boundaries.
496If not in a fold, acts like `widen'."
497 (interactive)
498 (if foldout-fold-list
499 (let* ((last-fold (car foldout-fold-list))
500 (start (car last-fold))
501 (end (cdr last-fold)))
502 (widen)
503 (narrow-to-region start
504 (if end (1- (marker-position end)) (point-max))))
505 (widen)))
506
507
493;;; Keymaps: 508;;; Keymaps:
494 509
495(defvar foldout-inhibit-key-bindings nil 510(defvar foldout-inhibit-key-bindings nil