aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2024-06-03 21:13:38 +0300
committerJuri Linkov2024-06-03 21:15:33 +0300
commitfe79a6ff507670a2ab79fca060c2727fcd0a4dae (patch)
tree3630d0df71e02f56e8f4f6c7a801d9c58c7eb615
parent642bf58d4fbff4493b629837564b7e5c77c7615c (diff)
downloademacs-fe79a6ff507670a2ab79fca060c2727fcd0a4dae.tar.gz
emacs-fe79a6ff507670a2ab79fca060c2727fcd0a4dae.zip
Move revert-buffer-restore-functions use from buff-menu.el to outline.el
* lisp/buff-menu.el (Buffer-menu-mode): Remove revert-buffer-restore-functions with handling of outline-minor-mode and move it to outline-minor-mode. * lisp/outline.el (outline-minor-mode): Add revert-buffer-restore-functions to call outline-minor-mode-highlight-buffer after reverting the buffer with outline-minor-mode and outline-minor-mode-highlight where font-lock can't be used to update highlighting.
-rw-r--r--lisp/buff-menu.el10
-rw-r--r--lisp/outline.el8
2 files changed, 9 insertions, 9 deletions
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index b431637414b..d59c5b6cf21 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -232,8 +232,6 @@ then the buffer will be displayed in the buffer list.")
232 ["Quit" quit-window 232 ["Quit" quit-window
233 :help "Remove the buffer menu from the display"])) 233 :help "Remove the buffer menu from the display"]))
234 234
235(declare-function outline-minor-mode-highlight-buffer "outline" ())
236
237(define-derived-mode Buffer-menu-mode tabulated-list-mode "Buffer Menu" 235(define-derived-mode Buffer-menu-mode tabulated-list-mode "Buffer Menu"
238 "Major mode for Buffer Menu buffers. 236 "Major mode for Buffer Menu buffers.
239The Buffer Menu is invoked by the commands \\[list-buffers], 237The Buffer Menu is invoked by the commands \\[list-buffers],
@@ -276,13 +274,7 @@ In Buffer Menu mode, the following commands are defined:
276 :interactive nil 274 :interactive nil
277 (setq-local buffer-stale-function 275 (setq-local buffer-stale-function
278 (lambda (&optional _noconfirm) 'fast)) 276 (lambda (&optional _noconfirm) 'fast))
279 (add-hook 'tabulated-list-revert-hook 'list-buffers--refresh nil t) 277 (add-hook 'tabulated-list-revert-hook 'list-buffers--refresh nil t))
280 (add-hook 'revert-buffer-restore-functions
281 (lambda ()
282 (when (bound-and-true-p outline-minor-mode)
283 (lambda ()
284 (outline-minor-mode-highlight-buffer))))
285 nil t))
286 278
287(defun buffer-menu--display-help () 279(defun buffer-menu--display-help ()
288 (message "%s" 280 (message "%s"
diff --git a/lisp/outline.el b/lisp/outline.el
index 5f4d4f3dcba..b7afa6b3f45 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -580,6 +580,14 @@ See the command `outline-mode' for more information on this mode."
580 (add-hook 'change-major-mode-hook 580 (add-hook 'change-major-mode-hook
581 (lambda () (outline-minor-mode -1)) 581 (lambda () (outline-minor-mode -1))
582 nil t) 582 nil t)
583 (add-hook 'revert-buffer-restore-functions
584 (lambda ()
585 (when (and outline-minor-mode outline-minor-mode-highlight
586 (not (and global-font-lock-mode
587 (font-lock-specified-p major-mode))))
588 (lambda ()
589 (outline-minor-mode-highlight-buffer))))
590 nil t)
583 (setq-local line-move-ignore-invisible t) 591 (setq-local line-move-ignore-invisible t)
584 ;; Cause use of ellipses for invisible text. 592 ;; Cause use of ellipses for invisible text.
585 (add-to-invisibility-spec '(outline . t)) 593 (add-to-invisibility-spec '(outline . t))