emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v
Date: Fri, 28 Jul 2006 23:03:19 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kim F. Storm <kfstorm>  06/07/28 23:03:19

Index: grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- grep.el     19 Jul 2006 11:19:27 -0000      1.62
+++ grep.el     28 Jul 2006 23:03:18 -0000      1.63
@@ -455,13 +455,17 @@
                   (search-forward "--color" nil t))
                 t)))))
 
-(defun grep-default-command ()
-  (let ((tag-default
-         (shell-quote-argument
-          (or (funcall (or find-tag-default-function
+(defun grep-tag-default ()
+  (or (and transient-mark-mode mark-active
+          (/= (point) (mark))
+          (buffer-substring-no-properties (point) (mark)))
+      (funcall (or find-tag-default-function
                            (get major-mode 'find-tag-default-function)
                            'find-tag-default))
-              "")))
+      ""))
+
+(defun grep-default-command ()
+  (let ((tag-default (shell-quote-argument (grep-tag-default)))
        (sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' 
\t\n]\\)+\\)")
        (grep-default (or (car grep-history) grep-command)))
     ;; Replace the thing matching for with that around cursor.
@@ -590,15 +594,11 @@
 
 (defun grep-read-regexp ()
   "Read regexp arg for interactive grep."
-  (let ((default
-         (or (funcall (or find-tag-default-function
-                          (get major-mode 'find-tag-default-function)
-                          'find-tag-default))
-             "")))
+  (let ((default (grep-tag-default)))
     (read-string
      (concat "Search for"
             (if (and default (> (length default) 0))
-                (format " (default %s): " default) ": "))
+                (format " (default \"%s\"): " default) ": "))
      nil 'grep-regexp-history default)))
 
 (defun grep-read-files (regexp)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]