From: Karl Heuer Date: Mon, 1 Jun 1998 03:08:53 +0000 (+0000) Subject: (grep): Fix previous change. X-Git-Tag: emacs-20.3~770 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d1208263cd848364650baafc62412528573f8a8d;p=emacs.git (grep): Fix previous change. --- diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index c74c2c570ca..6929e92708b 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -556,19 +556,21 @@ This command uses a special history list for its arguments, so you can easily repeat a grep command. A prefix argument says to default the argument based upon the current -tag the cursor is over." +tag the cursor is over, substituting it into the last grep command +in the grep command history (or into `grep-command' +if that history list is empty)." (interactive - (let (grep-default) - (when (and current-prefix-arg grep-history) + (let (grep-default (arg current-prefix-arg)) + (when arg (let* ((tag-default (funcall (or find-tag-default-function (get major-mode 'find-tag-default-function) ;; We use grep-tag-default instead of ;; find-tag-default, to avoid loading etags. 'grep-tag-default)))) - (setq grep-default (car grep-history)) + (setq grep-default (or (car grep-history) grep-command)) ;; Replace the thing matching for with that around cursor - (if (string-match "[^ ]+\\s +\\(-[^ ]+\\)*\\s *\\(\"[^\"]+\"\\|[^ ]+\\)" grep-default) + (if (string-match "[^ ]+\\s +\\(-[^ ]+\\s +\\)*\\(\"[^\"]+\"\\|[^ ]+\\)" grep-default) (setq grep-default (replace-match tag-default t t grep-default 2))))) (list (read-from-minibuffer "Run grep (like this): "