emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 e1e0a7a 2/2: xref--collect-matches: Speed up on remote


From: Dmitry Gutov
Subject: emacs-27 e1e0a7a 2/2: xref--collect-matches: Speed up on remote
Date: Fri, 27 Dec 2019 09:19:18 -0500 (EST)

branch: emacs-27
commit e1e0a7a7519d4d453bc1eaa355db41b321c8b5bb
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    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).
---
 lisp/progmodes/xref.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 13a1600..bbd3940 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]