From fa2ebb275e0ec1f88e154d55022548084d442736 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Thu, 24 Sep 2015 23:16:14 +1200 Subject: [PATCH] Prevent empty -path arguments in rgrep find commands rgrep's `grep-find-ignored-directories' conditional-ignore behaviour (for list elements which are cons cells) produces 'find' constraints like: "find . -type d \( -path -o -path \*/SCCS [...]" (i.e. a -path argument with no value) when the associated function returns nil. The nil elements need to be deleted from the list before the command line arguments are generated. --- lisp/progmodes/grep.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 3240ee8..452a42f 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1039,16 +1039,18 @@ to specify a command to run." ;; we should use shell-quote-argument here " -path " (mapconcat - #'(lambda (ignore) - (cond ((stringp ignore) - (shell-quote-argument - (concat "*/" ignore))) - ((consp ignore) - (and (funcall (car ignore) dir) - (shell-quote-argument - (concat "*/" - (cdr ignore))))))) - grep-find-ignored-directories + 'identity + (delq nil (mapcar + #'(lambda (ignore) + (cond ((stringp ignore) + (shell-quote-argument + (concat "*/" ignore))) + ((consp ignore) + (and (funcall (car ignore) dir) + (shell-quote-argument + (concat "*/" + (cdr ignore))))))) + grep-find-ignored-directories)) " -o -path ") " " (shell-quote-argument ")") -- 2.1.0