Commit e1e0a7a7 authored by Dmitry Gutov's avatar Dmitry Gutov

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).
parent 219b91eb
...@@ -1291,8 +1291,11 @@ Such as the current syntax table and the applied syntax properties." ...@@ -1291,8 +1291,11 @@ Such as the current syntax table and the applied syntax properties."
(defun xref--collect-matches (hit regexp tmp-buffer) (defun xref--collect-matches (hit regexp tmp-buffer)
(pcase-let* ((`(,line ,file ,text) hit) (pcase-let* ((`(,line ,file ,text) hit)
(file (and file (concat (file-remote-p default-directory) file))) (remote-id (file-remote-p default-directory))
(buf (xref--find-buffer-visiting file)) (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))) (syntax-needed (xref--regexp-syntax-dependent-p regexp)))
(if buf (if buf
(with-current-buffer buf (with-current-buffer buf
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment