shell-quote-argument DIR when appropriate
* 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 `~'.
This commit is contained in:
parent
922c7a3e48
commit
ab3ba912fc
2 changed files with 5 additions and 3 deletions
|
@ -172,7 +172,8 @@ to find the list of ignores for each directory."
|
||||||
(let ((command
|
(let ((command
|
||||||
(format "%s %s %s -type f -print0"
|
(format "%s %s %s -type f -print0"
|
||||||
find-program
|
find-program
|
||||||
dir
|
(shell-quote-argument
|
||||||
|
(expand-file-name dir))
|
||||||
(xref--find-ignores-arguments
|
(xref--find-ignores-arguments
|
||||||
(project-ignores project dir)
|
(project-ignores project dir)
|
||||||
(expand-file-name dir)))))
|
(expand-file-name dir)))))
|
||||||
|
|
|
@ -941,6 +941,8 @@ IGNORES is a list of glob patterns."
|
||||||
(require 'find-dired) ; for `find-name-arg'
|
(require 'find-dired) ; for `find-name-arg'
|
||||||
(defvar grep-find-template)
|
(defvar grep-find-template)
|
||||||
(defvar find-name-arg)
|
(defvar find-name-arg)
|
||||||
|
;; `shell-quote-argument' quotes the tilde as well.
|
||||||
|
(cl-assert (not (string-match-p "\\`~" dir)))
|
||||||
(grep-expand-template
|
(grep-expand-template
|
||||||
grep-find-template
|
grep-find-template
|
||||||
regexp
|
regexp
|
||||||
|
@ -952,14 +954,13 @@ IGNORES is a list of glob patterns."
|
||||||
(concat " -o " find-name-arg " "))
|
(concat " -o " find-name-arg " "))
|
||||||
" "
|
" "
|
||||||
(shell-quote-argument ")"))
|
(shell-quote-argument ")"))
|
||||||
dir
|
(shell-quote-argument dir)
|
||||||
(xref--find-ignores-arguments ignores dir)))
|
(xref--find-ignores-arguments ignores dir)))
|
||||||
|
|
||||||
(defun xref--find-ignores-arguments (ignores dir)
|
(defun xref--find-ignores-arguments (ignores dir)
|
||||||
"Convert IGNORES and DIR to a list of arguments for 'find'.
|
"Convert IGNORES and DIR to a list of arguments for 'find'.
|
||||||
IGNORES is a list of glob patterns. DIR is an absolute
|
IGNORES is a list of glob patterns. DIR is an absolute
|
||||||
directory, used as the root of the ignore globs."
|
directory, used as the root of the ignore globs."
|
||||||
;; `shell-quote-argument' quotes the tilde as well.
|
|
||||||
(cl-assert (not (string-match-p "\\`~" dir)))
|
(cl-assert (not (string-match-p "\\`~" dir)))
|
||||||
(when ignores
|
(when ignores
|
||||||
(concat
|
(concat
|
||||||
|
|
Loading…
Add table
Reference in a new issue