1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

* lisp/outline.el (outline-revert-buffer-restore-visibility): New function.

(outline-minor-mode): Add 'outline-revert-buffer-restore-visibility'
to 'revert-buffer-restore-functions' (bug#69511).
This commit is contained in:
Juri Linkov 2024-06-04 09:37:02 +03:00
parent 799f78a92c
commit f69826a63d

View File

@ -580,6 +580,8 @@ 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
#'outline-revert-buffer-restore-visibility nil t)
(add-hook 'revert-buffer-restore-functions
(lambda ()
(when (and outline-minor-mode outline-minor-mode-highlight
@ -1713,6 +1715,13 @@ for example, after reverting the buffer."
(concat "\\`" (regexp-quote heading) "\\'"))
(nreverse headings) "\\|"))))
(defun outline-revert-buffer-restore-visibility ()
"Preserve visibility of outlines in `outline-minor-mode' for `revert-buffer'."
(let ((regexp (outline-hidden-headings-regexp)))
(when regexp
(lambda ()
(outline-hide-by-heading-regexp regexp)))))
;;; Visibility cycling