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.
This commit is contained in:
Juri Linkov 2024-06-03 21:13:38 +03:00
parent 642bf58d4f
commit fe79a6ff50
2 changed files with 9 additions and 9 deletions

View file

@ -232,8 +232,6 @@ then the buffer will be displayed in the buffer list.")
["Quit" quit-window
:help "Remove the buffer menu from the display"]))
(declare-function outline-minor-mode-highlight-buffer "outline" ())
(define-derived-mode Buffer-menu-mode tabulated-list-mode "Buffer Menu"
"Major mode for Buffer Menu buffers.
The Buffer Menu is invoked by the commands \\[list-buffers],
@ -276,13 +274,7 @@ In Buffer Menu mode, the following commands are defined:
:interactive nil
(setq-local buffer-stale-function
(lambda (&optional _noconfirm) 'fast))
(add-hook 'tabulated-list-revert-hook 'list-buffers--refresh nil t)
(add-hook 'revert-buffer-restore-functions
(lambda ()
(when (bound-and-true-p outline-minor-mode)
(lambda ()
(outline-minor-mode-highlight-buffer))))
nil t))
(add-hook 'tabulated-list-revert-hook 'list-buffers--refresh nil t))
(defun buffer-menu--display-help ()
(message "%s"

View file

@ -580,6 +580,14 @@ See the command `outline-mode' for more information on this mode."
(add-hook 'change-major-mode-hook
(lambda () (outline-minor-mode -1))
nil t)
(add-hook 'revert-buffer-restore-functions
(lambda ()
(when (and outline-minor-mode outline-minor-mode-highlight
(not (and global-font-lock-mode
(font-lock-specified-p major-mode))))
(lambda ()
(outline-minor-mode-highlight-buffer))))
nil t)
(setq-local line-move-ignore-invisible t)
;; Cause use of ellipses for invisible text.
(add-to-invisibility-spec '(outline . t))