1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-05 07:01:11 -08:00

A bit less overhead when converting hits

* lisp/progmodes/xref.el (xref--collect-matches):
Move 'remote-id' and 'syntax-needed' definitions to the caller
function.  Bind 'inhibit-modification-hooks' to t (bug#50733).
This commit is contained in:
Dmitry Gutov 2021-09-23 21:40:36 +03:00
parent 0101e86df2
commit e646cb4e7a

View file

@ -1831,18 +1831,20 @@ Such as the current syntax table and the applied syntax properties."
(defun xref--convert-hits (hits regexp)
(let (xref--last-file-buffer
(tmp-buffer (generate-new-buffer " *xref-temp*")))
(tmp-buffer (generate-new-buffer " *xref-temp*"))
(remote-id (file-remote-p default-directory))
(syntax-needed (xref--regexp-syntax-dependent-p regexp)))
(unwind-protect
(mapcan (lambda (hit) (xref--collect-matches hit regexp tmp-buffer))
(mapcan (lambda (hit)
(xref--collect-matches hit regexp tmp-buffer remote-id syntax-needed))
hits)
(kill-buffer tmp-buffer))))
(defun xref--collect-matches (hit regexp tmp-buffer)
(defun xref--collect-matches (hit regexp tmp-buffer remote-id syntax-needed)
(pcase-let* ((`(,line ,file ,text) hit)
(remote-id (file-remote-p default-directory))
(file (and file (concat remote-id file)))
(buf (xref--find-file-buffer file))
(syntax-needed (xref--regexp-syntax-dependent-p regexp)))
(inhibit-modification-hooks t))
(if buf
(with-current-buffer buf
(save-excursion