diff options
author | Paul Nelson <ultrono@gmail.com> | 2024-09-16 01:33:53 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2024-10-12 14:52:32 +0300 |
commit | ebfd5874f0b74cec06572ffc3e9bf7288bd5e77b (patch) | |
tree | 6a12665162ddca8b2ccc5222bb88ba95f8fab418 /lisp | |
parent | 0e9502b10e08d1c93fe9b134b8cf74eae42c1eae (diff) | |
download | emacs-ebfd5874f0b74cec06572ffc3e9bf7288bd5e77b.tar.gz emacs-ebfd5874f0b74cec06572ffc3e9bf7288bd5e77b.tar.bz2 emacs-ebfd5874f0b74cec06572ffc3e9bf7288bd5e77b.zip |
Add foldout command for widening to current fold
* lisp/foldout.el (foldout-widen-to-current-fold): New command.
* doc/emacs/text.texi (Foldout): Document it.
* etc/NEWS: Announce it. (Bug#73286)
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/foldout.el | 15 |
1 files changed, 15 insertions, 0 deletions
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." (error "Not a heading line"))) +(defun foldout-widen-to-current-fold () + "Widen to the current fold level. +If in a fold, widen to that fold's boundaries. +If not in a fold, acts like `widen'." + (interactive) + (if foldout-fold-list + (let* ((last-fold (car foldout-fold-list)) + (start (car last-fold)) + (end (cdr last-fold))) + (widen) + (narrow-to-region start + (if end (1- (marker-position end)) (point-max)))) + (widen))) + + ;;; Keymaps: (defvar foldout-inhibit-key-bindings nil |