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

xref--collect-matches: Speed up on remote

* lisp/progmodes/xref.el (xref--collect-matches):
Don't call find-buffer-visiting on remote file names, it's pretty
slow (bug#34343).
This commit is contained in:
Dmitry Gutov 2019-12-27 17:08:53 +03:00
parent 219b91eb2c
commit e1e0a7a751

View file

@ -1291,8 +1291,11 @@ Such as the current syntax table and the applied syntax properties."
(defun xref--collect-matches (hit regexp tmp-buffer)
(pcase-let* ((`(,line ,file ,text) hit)
(file (and file (concat (file-remote-p default-directory) file)))
(buf (xref--find-buffer-visiting file))
(remote-id (file-remote-p default-directory))
(file (and file (concat remote-id file)))
(buf (unless remote-id
;; find-buffer-visiting is slow on remote.
(xref--find-buffer-visiting file)))
(syntax-needed (xref--regexp-syntax-dependent-p regexp)))
(if buf
(with-current-buffer buf