1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-20 04:30:55 -08:00

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)
This commit is contained in:
Eli Zaretskii 2020-04-29 18:58:42 +03:00
parent 274ec97e3c
commit 7a12ab5ea2

View file

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