summaryrefslogtreecommitdiff
path: root/lisp/progmodes/xref.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2021-09-23 21:40:36 +0300
committerDmitry Gutov <dgutov@yandex.ru>2021-09-23 21:45:16 +0300
commite646cb4e7a46132a7717a94fe3632ecb03f080fc (patch)
tree5a5ba75a43fc4918de9a6d920993e5f2e900c2e5 /lisp/progmodes/xref.el
parent0101e86df2378cbe4eff1814fe86cd3760ca6d99 (diff)
downloademacs-e646cb4e7a46132a7717a94fe3632ecb03f080fc.tar.gz
emacs-e646cb4e7a46132a7717a94fe3632ecb03f080fc.tar.bz2
emacs-e646cb4e7a46132a7717a94fe3632ecb03f080fc.zip
A bit less overhead when converting hits
* lisp/progmodes/xref.el (xref--collect-matches): Move 'remote-id' and 'syntax-needed' definitions to the caller function. Bind 'inhibit-modification-hooks' to t (bug#50733).
Diffstat (limited to 'lisp/progmodes/xref.el')
-rw-r--r--lisp/progmodes/xref.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 62f66b2018a..fb8090cfb72 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1831,18 +1831,20 @@ Such as the current syntax table and the applied syntax properties."
(defun xref--convert-hits (hits regexp)
(let (xref--last-file-buffer
- (tmp-buffer (generate-new-buffer " *xref-temp*")))
+ (tmp-buffer (generate-new-buffer " *xref-temp*"))
+ (remote-id (file-remote-p default-directory))
+ (syntax-needed (xref--regexp-syntax-dependent-p regexp)))
(unwind-protect
- (mapcan (lambda (hit) (xref--collect-matches hit regexp tmp-buffer))
+ (mapcan (lambda (hit)
+ (xref--collect-matches hit regexp tmp-buffer remote-id syntax-needed))
hits)
(kill-buffer tmp-buffer))))
-(defun xref--collect-matches (hit regexp tmp-buffer)
+(defun xref--collect-matches (hit regexp tmp-buffer remote-id syntax-needed)
(pcase-let* ((`(,line ,file ,text) hit)
- (remote-id (file-remote-p default-directory))
(file (and file (concat remote-id file)))
(buf (xref--find-file-buffer file))
- (syntax-needed (xref--regexp-syntax-dependent-p regexp)))
+ (inhibit-modification-hooks t))
(if buf
(with-current-buffer buf
(save-excursion