[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69511: Restore any state after revert-buffer
From: |
Juri Linkov |
Subject: |
bug#69511: Restore any state after revert-buffer |
Date: |
Tue, 04 Jun 2024 09:37:18 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
close 69511 30.0.50
thanks
> One of numerous examples is to save and restore
> hidden outlines after doing 'revert-buffer':
>
> (add-hook 'Buffer-menu-mode-hook
> (lambda ()
> (add-hook 'revert-buffer-state-functions
> (lambda ()
> (let ((regexp (outline-hidden-headings-regexp)))
> (when regexp
> (lambda ()
> (outline-hide-by-heading-regexp regexp))))))))
>
> Currently this handles outlines only in the buffer list.
> But probably this settings should be added to outline-minor-mode.
This is now adapted to outline-minor-mode.
(xref needs changes as well, so the patch is sent to bug#49731).
> And here is the immediate need to use it to rehighlight the outlines
> after reverting the buffer list:
>
> diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
> + (add-hook 'tabulated-list-revert-hook 'list-buffers--refresh nil t)
> + (add-hook 'revert-buffer-state-functions
> + (lambda ()
> + (when (bound-and-true-p outline-minor-mode)
> + (lambda ()
> + (outline-minor-mode-highlight-buffer))))))
And this was moved to outline-minor-mode as well.