]> code.delx.au - gnu-emacs/commitdiff
shell-quote-argument DIR when appropriate
authorDmitry Gutov <dgutov@yandex.ru>
Thu, 5 May 2016 01:15:23 +0000 (04:15 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 5 May 2016 01:15:23 +0000 (04:15 +0300)
* lisp/progmodes/project.el (project-file-completion-table):
`shell-quote-argument' DIR as well.

* lisp/progmodes/xref.el (xref--rgrep-command): Pass DIR through
`shell-quote-argument' (bug#23453).  Thanks for Kaushal Modi for
pointing out the problem.  Assert that DIR doesn't start with `~'.

lisp/progmodes/project.el
lisp/progmodes/xref.el

index 9c8a88c80fc8651ab7e7848ea1776793a54b0d56..a51c383b93b9b9a41d3cc191db61a1d29f3decdf 100644 (file)
@@ -172,7 +172,8 @@ to find the list of ignores for each directory."
            (let ((command
                   (format "%s %s %s -type f -print0"
                           find-program
-                          dir
+                           (shell-quote-argument
+                            (expand-file-name dir))
                           (xref--find-ignores-arguments
                            (project-ignores project dir)
                            (expand-file-name dir)))))
index 17bfdb69f8f8594936c635a9532fea7bc6291982..1c28390258ca0348b53a2f2ae24d6008d2fb467f 100644 (file)
@@ -941,6 +941,8 @@ IGNORES is a list of glob patterns."
   (require 'find-dired)      ; for `find-name-arg'
   (defvar grep-find-template)
   (defvar find-name-arg)
+  ;; `shell-quote-argument' quotes the tilde as well.
+  (cl-assert (not (string-match-p "\\`~" dir)))
   (grep-expand-template
    grep-find-template
    regexp
@@ -952,14 +954,13 @@ IGNORES is a list of glob patterns."
             (concat " -o " find-name-arg " "))
            " "
            (shell-quote-argument ")"))
-   dir
+   (shell-quote-argument dir)
    (xref--find-ignores-arguments ignores dir)))
 
 (defun xref--find-ignores-arguments (ignores dir)
   "Convert IGNORES and DIR to a list of arguments for 'find'.
 IGNORES is a list of glob patterns.  DIR is an absolute
 directory, used as the root of the ignore globs."
-  ;; `shell-quote-argument' quotes the tilde as well.
   (cl-assert (not (string-match-p "\\`~" dir)))
   (when ignores
     (concat