emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 7a12ab5: Fix project.el commands in "transient" projects


From: Eli Zaretskii
Subject: emacs-27 7a12ab5: Fix project.el commands in "transient" projects
Date: Wed, 29 Apr 2020 12:00:45 -0400 (EDT)

branch: emacs-27
commit 7a12ab5ea2257f8e9d3f4ba03918cf9709a728e1
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix project.el commands in "transient" projects
    
    * lisp/progmodes/project.el (project--files-in-directory): Run
    local DIR directory names through 'expand-file-name', so that "~/"
    is expanded, in case the shell doesn't or the shell's notion of
    the home directory is different from that of Emacs.  (Bug#40940)
---
 lisp/progmodes/project.el | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 1f4cbe9..dbc967b 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -185,23 +185,27 @@ to find the list of ignores for each directory."
   (require 'find-dired)
   (require 'xref)
   (defvar find-name-arg)
-  (let ((default-directory dir)
-        (command (format "%s %s %s -type f %s -print0"
-                         find-program
-                         (file-local-name dir)
-                         (xref--find-ignores-arguments
-                          ignores
-                          (expand-file-name dir))
-                         (if files
-                             (concat (shell-quote-argument "(")
-                                     " " find-name-arg " "
-                                     (mapconcat
-                                      #'shell-quote-argument
-                                      (split-string files)
-                                      (concat " -o " find-name-arg " "))
-                                     " "
-                                     (shell-quote-argument ")"))"")
-                         )))
+  (let* ((default-directory dir)
+         (dirname (file-remote-p dir 'localname))
+         (dirname (or dirname
+                      ;; Make sure ~/ etc. in local directory name is
+                      ;; expanded and not left for the shell command
+                      ;; to interpret.
+                      (expand-file-name dir)))
+         (command (format "%s %s %s -type f %s -print0"
+                          find-program
+                          dirname
+                          (xref--find-ignores-arguments ignores dirname)
+                          (if files
+                              (concat (shell-quote-argument "(")
+                                      " " find-name-arg " "
+                                      (mapconcat
+                                       #'shell-quote-argument
+                                       (split-string files)
+                                       (concat " -o " find-name-arg " "))
+                                      " "
+                                      (shell-quote-argument ")"))"")
+                          )))
     (project--remote-file-names
      (sort (split-string (shell-command-to-string command) "\0" t)
            #'string<))))



reply via email to

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