changeset 57908:a4ed247d476f

(grep-default-command): Take empty string for tag if all other methods yield nil. Shell-quote the tag.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Wed, 03 Nov 2004 11:43:36 +0000
parents 436b42c65828
children f36e839cbfbc
files lisp/progmodes/grep.el
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/grep.el	Wed Nov 03 10:41:46 2004 +0000
+++ b/lisp/progmodes/grep.el	Wed Nov 03 11:43:36 2004 +0000
@@ -436,9 +436,11 @@
 
 (defun grep-default-command ()
   (let ((tag-default
-	 (funcall (or find-tag-default-function
-		      (get major-mode 'find-tag-default-function)
-		      'find-tag-default)))
+         (shell-quote-argument
+          (or (funcall (or find-tag-default-function
+                           (get major-mode 'find-tag-default-function)
+                           'find-tag-default))
+              "")))
 	(sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)")
 	(grep-default (or (car grep-history) grep-command)))
     ;; Replace the thing matching for with that around cursor.
@@ -460,7 +462,7 @@
 					      0 (match-beginning 2))
 				   " *."
 				   (file-name-extension buffer-file-name))))
-      (replace-match (or tag-default "") t t grep-default 1))))
+      (replace-match tag-default t t grep-default 1))))
 
 ;;;###autoload
 (defun grep (command-args &optional highlight-regexp)