changeset 72555:20f4483c11ca

(find-dired): Use shell-quote-argument to properly escape ( and ) args. Also use it on {} and ; args in default value of find-ls-option string. (find-grep-dired): Use shell-quote-argument on {} and ; args.
author Kim F. Storm <storm@cua.dk>
date Mon, 28 Aug 2006 08:02:38 +0000
parents 28a8ed4ad552
children bb3f9c6499b6
files lisp/find-dired.el
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/find-dired.el	Mon Aug 28 08:02:24 2006 +0000
+++ b/lisp/find-dired.el	Mon Aug 28 08:02:38 2006 +0000
@@ -129,8 +129,17 @@
 	  args (concat find-dired-find-program " . "
 		       (if (string= args "")
 			   ""
-			 (concat "\\( " args " \\) "))
-		       (car find-ls-option)))
+			 (concat
+			  (shell-quote-argument "(")
+			  " " args " "
+			  (shell-quote-argument ")")
+			  " "))
+		       (if (equal (car find-ls-option) "-exec ls -ld {} \\;")
+			   (concat "-exec ls -ld "
+				   (shell-quote-argument "{}")
+				   " "
+				   (shell-quote-argument ";"))
+			 (car find-ls-option))))
     ;; Start the find process.
     (shell-command (concat args "&") (current-buffer))
     ;; The next statement will bomb in classic dired (no optional arg allowed)
@@ -215,7 +224,10 @@
   (find-dired dir
 	      (concat "-type f -exec grep " find-grep-options " -e "
 		      (shell-quote-argument regexp)
-		      " {} \\\; ")))
+		      " "
+		      (shell-quote-argument "{}")
+		      " "
+		      (shell-quote-argument ";"))))
 
 (defun find-dired-filter (proc string)
   ;; Filter for \\[find-dired] processes.