Use revert-buffer-restore-functions in xref-revert-buffer (bug#49731)

* lisp/progmodes/xref.el (xref-revert-buffer):
When 'revert-buffer-restore-functions' is bound,
use it in the same way as in 'revert-buffer'.
This commit is contained in:
Juri Linkov 2024-06-05 09:35:50 +03:00
parent 854552fd0d
commit a2b6e18d60

View file

@ -1277,13 +1277,18 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)."
"Refresh the search results in the current buffer."
(interactive)
(let ((inhibit-read-only t)
(buffer-undo-list t))
(buffer-undo-list t)
restore-functions)
(when (boundp 'revert-buffer-restore-functions)
(run-hook-wrapped 'revert-buffer-restore-functions
(lambda (f) (push (funcall f) restore-functions) nil)))
(save-excursion
(condition-case err
(let ((alist (xref--analyze (funcall xref--fetcher)))
(inhibit-modification-hooks t))
(erase-buffer)
(xref--insert-xrefs alist))
(prog1 (xref--insert-xrefs alist)
(mapc #'funcall (delq nil restore-functions))))
(user-error
(erase-buffer)
(insert