From 018eeb655aa66ce1f32288ed2c23c042877a578b Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 26 Feb 2022 02:18:34 +0200 Subject: [PATCH] Drop the visited file modtime check for remote xref hits * lisp/progmodes/xref.el (xref--hits-remote-id): New variable. (xref--convert-hits, xref--collect-matches) (xref--find-file-buffer): Use it (bug#54025). --- lisp/progmodes/xref.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 96fb835d0ff..5b27c835848 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1923,21 +1923,22 @@ Such as the current syntax table and the applied syntax properties." (defvar xref--last-file-buffer nil) (defvar xref--temp-buffer-file-name nil) +(defvar xref--hits-remote-id nil) (defun xref--convert-hits (hits regexp) (let (xref--last-file-buffer (tmp-buffer (generate-new-buffer " *xref-temp*")) - (remote-id (file-remote-p default-directory)) + (xref--hits-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 remote-id syntax-needed)) + (xref--collect-matches hit regexp tmp-buffer syntax-needed)) hits) (kill-buffer tmp-buffer)))) -(defun xref--collect-matches (hit regexp tmp-buffer remote-id syntax-needed) +(defun xref--collect-matches (hit regexp tmp-buffer syntax-needed) (pcase-let* ((`(,line ,file ,text) hit) - (file (and file (concat remote-id file))) + (file (and file (concat xref--hits-remote-id file))) (buf (xref--find-file-buffer file)) (inhibit-modification-hooks t)) (if buf @@ -2016,7 +2017,8 @@ Such as the current syntax table and the applied syntax properties." (when (and buf (or (buffer-modified-p buf) - (not (verify-visited-file-modtime (current-buffer))))) + (unless xref--hits-remote-id + (not (verify-visited-file-modtime (current-buffer)))))) ;; We can't use buffers whose contents diverge from disk (bug#54025). (setq buf nil)) (setq xref--last-file-buffer (cons file buf)))) -- 2.39.5