diff options
| author | Dmitry Gutov | 2019-12-27 17:08:53 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2019-12-27 17:19:00 +0300 |
| commit | e1e0a7a7519d4d453bc1eaa355db41b321c8b5bb (patch) | |
| tree | 7aa8ce90d73007430eb04189cdd9f4c7c2a0f9f7 | |
| parent | 219b91eb2c515108e0ff7fd4ae21f17924eb6b01 (diff) | |
| download | emacs-e1e0a7a7519d4d453bc1eaa355db41b321c8b5bb.tar.gz emacs-e1e0a7a7519d4d453bc1eaa355db41b321c8b5bb.zip | |
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).
| -rw-r--r-- | lisp/progmodes/xref.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 13a1600594f..bbd3940be4f 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." | |||
| 1291 | 1291 | ||
| 1292 | (defun xref--collect-matches (hit regexp tmp-buffer) | 1292 | (defun xref--collect-matches (hit regexp tmp-buffer) |
| 1293 | (pcase-let* ((`(,line ,file ,text) hit) | 1293 | (pcase-let* ((`(,line ,file ,text) hit) |
| 1294 | (file (and file (concat (file-remote-p default-directory) file))) | 1294 | (remote-id (file-remote-p default-directory)) |
| 1295 | (buf (xref--find-buffer-visiting file)) | 1295 | (file (and file (concat remote-id file))) |
| 1296 | (buf (unless remote-id | ||
| 1297 | ;; find-buffer-visiting is slow on remote. | ||
| 1298 | (xref--find-buffer-visiting file))) | ||
| 1296 | (syntax-needed (xref--regexp-syntax-dependent-p regexp))) | 1299 | (syntax-needed (xref--regexp-syntax-dependent-p regexp))) |
| 1297 | (if buf | 1300 | (if buf |
| 1298 | (with-current-buffer buf | 1301 | (with-current-buffer buf |