From f955df1788b9ee77ffeff6a91a906b8274cbf639 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 16 Apr 2021 03:52:44 +0300 Subject: [PATCH] Improve quoting of directory names in project/xref * lisp/progmodes/project.el (project--files-in-directory): Quote LOCALDIR a bit earlier, to affect xref--find-ignores-arguments as well (bug#47799). * lisp/progmodes/xref.el (xref-matches-in-directory): Quote the dir passed to xref--rgrep-command. --- lisp/progmodes/project.el | 5 ++--- lisp/progmodes/xref.el | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 1edbe069a4c..1023b75e668 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -296,12 +296,11 @@ to find the list of ignores for each directory." ;; Make sure ~/ etc. in local directory name is ;; expanded and not left for the shell command ;; to interpret. - (localdir (file-local-name (expand-file-name dir))) + (localdir (file-name-unquote (file-local-name (expand-file-name dir)))) (command (format "%s %s %s -type f %s -print0" find-program ;; In case DIR is a symlink. - (file-name-unquote - (file-name-as-directory localdir)) + (file-name-as-directory localdir) (xref--find-ignores-arguments ignores localdir) (if files (concat (shell-quote-argument "(") diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index cada1f11092..3d2f21ab52f 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1416,7 +1416,8 @@ IGNORES is a list of glob patterns for files to ignore." (command (xref--rgrep-command (xref--regexp-to-extended regexp) files (file-name-as-directory - (file-local-name (expand-file-name dir))) + (file-name-unquote + (file-local-name (expand-file-name dir)))) ignores)) (def default-directory) (buf (get-buffer-create " *xref-grep*")) -- 2.39.5