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

Update 'xref-num-matches-found' when reverting *xref* buffer

* lisp/progmodes/xref.el (xref--insert-xrefs):
Update 'xref-num-matches-found' here...
(xref--show-xref-buffer): ...instead of here (bug#74313).
This commit is contained in:
Eshel Yaron 2024-11-11 19:45:10 +01:00 committed by Dmitry Gutov
parent 8afcfed825
commit 6bc44ccf28

View File

@ -1140,6 +1140,7 @@ XREF-ALIST is of the form ((GROUP . (XREF ...)) ...), where
GROUP is a string for decoration purposes and XREF is an GROUP is a string for decoration purposes and XREF is an
`xref-item' object." `xref-item' object."
(require 'compile) ; For the compilation faces. (require 'compile) ; For the compilation faces.
(setq xref-num-matches-found 0)
(cl-loop for (group . xrefs) in xref-alist (cl-loop for (group . xrefs) in xref-alist
for max-line = (cl-loop for xref in xrefs for max-line = (cl-loop for xref in xrefs
maximize (xref-location-line maximize (xref-location-line
@ -1159,6 +1160,7 @@ GROUP is a string for decoration purposes and XREF is an
(xref--insert-propertized '(face xref-file-header xref-group t) (xref--insert-propertized '(face xref-file-header xref-group t)
group "\n") group "\n")
(dolist (xref xrefs) (dolist (xref xrefs)
(cl-incf xref-num-matches-found)
(pcase-let (((cl-struct xref-item summary location) xref)) (pcase-let (((cl-struct xref-item summary location) xref))
(let* ((line (xref-location-line location)) (let* ((line (xref-location-line location))
(prefix (prefix
@ -1248,7 +1250,6 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)."
(xref--ensure-default-directory dd (current-buffer)) (xref--ensure-default-directory dd (current-buffer))
(xref--xref-buffer-mode) (xref--xref-buffer-mode)
(xref--show-common-initialize xref-alist fetcher alist) (xref--show-common-initialize xref-alist fetcher alist)
(setq xref-num-matches-found (length xrefs))
(setq mode-line-process (list xref-mode-line-matches)) (setq mode-line-process (list xref-mode-line-matches))
(pop-to-buffer (current-buffer)) (pop-to-buffer (current-buffer))
(setq buf (current-buffer))) (setq buf (current-buffer)))