emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 be38e39: project--find-regexp-in-files: Support remote files


From: Dmitry Gutov
Subject: emacs-27 be38e39: project--find-regexp-in-files: Support remote files
Date: Thu, 26 Dec 2019 09:00:52 -0500 (EST)

branch: emacs-27
commit be38e39fccab7c2f8e86c59ffb9c022d3d5b9382
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    project--find-regexp-in-files: Support remote files
    
    * lisp/progmodes/project.el (project--find-regexp-in-files):
    Support remote files (bug#34343).
---
 lisp/progmodes/project.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index e45cb5d..d5920d1 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -450,6 +450,9 @@ pattern to search for."
        (status nil)
        (hits nil)
        (xrefs nil)
+       ;; Support for remote files.
+       (dir (file-name-directory (car files)))
+       (remote-id (file-remote-p dir))
        ;; 'git ls-files' can output broken symlinks.
        (command (format "xargs -0 grep %s -snHE -e %s"
                         (if (and case-fold-search
@@ -457,10 +460,13 @@ pattern to search for."
                             "-i"
                           "")
                         (shell-quote-argument (xref--regexp-to-extended 
regexp)))))
+    (when remote-id
+      (setq files (mapcar #'file-local-name files)))
     (with-current-buffer output
       (erase-buffer)
       (with-temp-buffer
         (insert (mapconcat #'identity files "\0"))
+        (setq default-directory dir)
         (setq status
               (project--process-file-region (point-min)
                                             (point-max)
@@ -478,7 +484,7 @@ pattern to search for."
                     (buffer-substring (point-min) (line-end-position))))
       (while (re-search-forward grep-re nil t)
         (push (list (string-to-number (match-string line-group))
-                    (match-string file-group)
+                    (concat remote-id (match-string file-group))
                     (buffer-substring-no-properties (point) 
(line-end-position)))
               hits)))
     (setq xrefs (xref--convert-hits (nreverse hits) regexp))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]