Skip to content

Commit b46c75b

Browse files
committed
xref-matches-in-files: Big Tramp speed-up
* lisp/progmodes/xref.el (xref-matches-in-files): Greatly improve performance with remote files using Tramp (bug#34343).
1 parent 883b349 commit b46c75b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lisp/progmodes/xref.el

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,9 @@ IGNORES is a list of glob patterns for files to ignore."
12181218
#'xref-matches-in-directory
12191219
"27.1")
12201220

1221+
(declare-function tramp-tramp-file-p "tramp")
1222+
(declare-function tramp-file-local-name "tramp")
1223+
12211224
;;;###autoload
12221225
(defun xref-matches-in-files (regexp files)
12231226
"Find all matches for REGEXP in FILES.
@@ -1240,7 +1243,12 @@ FILES must be a list of absolute file names."
12401243
"")
12411244
(shell-quote-argument (xref--regexp-to-extended regexp)))))
12421245
(when remote-id
1243-
(setq files (mapcar #'file-local-name files)))
1246+
(require 'tramp)
1247+
(setq files (mapcar
1248+
(if (tramp-tramp-file-p dir)
1249+
#'tramp-file-local-name
1250+
#'file-local-name)
1251+
files)))
12441252
(with-current-buffer output
12451253
(erase-buffer)
12461254
(with-temp-buffer

0 commit comments

Comments
 (0)