emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c04ac61: Make `outline-hide-body' work in `C-h b' buffers


From: Lars Ingebrigtsen
Subject: master c04ac61: Make `outline-hide-body' work in `C-h b' buffers
Date: Sat, 6 Nov 2021 14:49:22 -0400 (EDT)

branch: master
commit c04ac61a7c87180dcb485863248ae56871d2e861
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/outline.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/outline.el b/lisp/outline.el
index 5b20a42..40618b0 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]