]> git.eshelyaron.com Git - emacs.git/commitdiff
xref-matches-in-files: Big Tramp speed-up
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 7 Jan 2020 13:30:25 +0000 (16:30 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 7 Jan 2020 13:30:37 +0000 (16:30 +0300)
* lisp/progmodes/xref.el (xref-matches-in-files):
Greatly improve performance with remote files using Tramp
(bug#34343).

lisp/progmodes/xref.el

index a8ca6f8fbeced44deac7f6a3c7267a7f24fb36c9..4fbcd08506b799695ebb379a20228c74432ac532 100644 (file)
@@ -1218,6 +1218,9 @@ IGNORES is a list of glob patterns for files to ignore."
   #'xref-matches-in-directory
   "27.1")
 
+(declare-function tramp-tramp-file-p "tramp")
+(declare-function tramp-file-local-name "tramp")
+
 ;;;###autoload
 (defun xref-matches-in-files (regexp files)
   "Find all matches for REGEXP in FILES.
@@ -1240,7 +1243,12 @@ FILES must be a list of absolute file names."
                           "")
                         (shell-quote-argument (xref--regexp-to-extended regexp)))))
     (when remote-id
-      (setq files (mapcar #'file-local-name files)))
+      (require 'tramp)
+      (setq files (mapcar
+                   (if (tramp-tramp-file-p dir)
+                       #'tramp-file-local-name
+                       #'file-local-name)
+                   files)))
     (with-current-buffer output
       (erase-buffer)
       (with-temp-buffer