summaryrefslogtreecommitdiff
path: root/lisp/outline.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-06 19:49:07 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-06 19:49:11 +0100
commitc04ac61a7c87180dcb485863248ae56871d2e861 (patch)
treebec2dd9b3710aeecf73e58b8c380ce5cea0f5c8e /lisp/outline.el
parent2893ea4e4c8b613aad3cf9c789c73a6a6674435c (diff)
downloademacs-c04ac61a7c87180dcb485863248ae56871d2e861.tar.gz
Make `outline-hide-body' work in `C-h b' buffers
* lisp/outline.el (outline-flag-region): Update buttons on most outline toggling commands (bug#51629). (outline--fix-up-all-buttons): Take a region as parameter. (outline-cycle-buffer): Adjust call.
Diffstat (limited to 'lisp/outline.el')
-rw-r--r--lisp/outline.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/outline.el b/lisp/outline.el
index 5b20a42c97b..40618b0a9bd 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -826,6 +826,7 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden."
(overlay-put o 'isearch-open-invisible
(or outline-isearch-open-invisible-function
#'outline-isearch-open-invisible))))
+ (outline--fix-up-all-buttons from to)
;; Seems only used by lazy-lock. I.e. obsolete.
(run-hooks 'outline-view-change-hook))
@@ -1002,13 +1003,18 @@ If non-nil, EVENT should be a mouse event."
["RET"] #'outline-show-subtree
["<mouse-2>"] #'outline-show-subtree)))))
-(defun outline--fix-up-all-buttons ()
- (outline-map-region
- (lambda ()
- (if (eq (outline--cycle-state) 'show-all)
- (outline--insert-open-button)
- (outline--insert-close-button)))
- (point-min) (point-max)))
+(defun outline--fix-up-all-buttons (&optional from to)
+ (when from
+ (save-excursion
+ (goto-char from)
+ (setq from (line-beginning-position))))
+ (when outline-minor-mode-use-buttons
+ (outline-map-region
+ (lambda ()
+ (if (eq (outline--cycle-state) 'show-all)
+ (outline--insert-open-button)
+ (outline--insert-close-button)))
+ (or from (point-min)) (or to (point-max)))))
(define-obsolete-function-alias 'hide-subtree #'outline-hide-subtree "25.1")
@@ -1382,8 +1388,7 @@ Return either 'hide-all, 'headings-only, or 'show-all."
(outline-show-all)
(setq outline--cycle-buffer-state 'show-all)
(message "Show all")))
- (when outline-minor-mode-use-buttons
- (outline--fix-up-all-buttons))))
+ (outline--fix-up-all-buttons)))
(defvar outline-navigation-repeat-map
(let ((map (make-sparse-keymap)))