Mercurial > emacs
changeset 22307:57d1e5467c24
(grep): Fix previous change.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 01 Jun 1998 03:08:53 +0000 |
parents | 6819832df39b |
children | 87366acfb1e9 |
files | lisp/progmodes/compile.el |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/compile.el Mon Jun 01 03:08:00 1998 +0000 +++ b/lisp/progmodes/compile.el Mon Jun 01 03:08:53 1998 +0000 @@ -556,19 +556,21 @@ 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): "