comparison lisp/progmodes/compile.el @ 22307:57d1e5467c24

(grep): Fix previous change.
author Karl Heuer <kwzh@gnu.org>
date Mon, 01 Jun 1998 03:08:53 +0000
parents 7c8d8ad75d43
children 9862ae4f05a7
comparison
equal deleted inserted replaced
22306:6819832df39b 22307:57d1e5467c24
554 554
555 This command uses a special history list for its arguments, so you can 555 This command uses a special history list for its arguments, so you can
556 easily repeat a grep command. 556 easily repeat a grep command.
557 557
558 A prefix argument says to default the argument based upon the current 558 A prefix argument says to default the argument based upon the current
559 tag the cursor is over." 559 tag the cursor is over, substituting it into the last grep command
560 in the grep command history (or into `grep-command'
561 if that history list is empty)."
560 (interactive 562 (interactive
561 (let (grep-default) 563 (let (grep-default (arg current-prefix-arg))
562 (when (and current-prefix-arg grep-history) 564 (when arg
563 (let* ((tag-default 565 (let* ((tag-default
564 (funcall (or find-tag-default-function 566 (funcall (or find-tag-default-function
565 (get major-mode 'find-tag-default-function) 567 (get major-mode 'find-tag-default-function)
566 ;; We use grep-tag-default instead of 568 ;; We use grep-tag-default instead of
567 ;; find-tag-default, to avoid loading etags. 569 ;; find-tag-default, to avoid loading etags.
568 'grep-tag-default)))) 570 'grep-tag-default))))
569 (setq grep-default (car grep-history)) 571 (setq grep-default (or (car grep-history) grep-command))
570 ;; Replace the thing matching for with that around cursor 572 ;; Replace the thing matching for with that around cursor
571 (if (string-match "[^ ]+\\s +\\(-[^ ]+\\)*\\s *\\(\"[^\"]+\"\\|[^ ]+\\)" grep-default) 573 (if (string-match "[^ ]+\\s +\\(-[^ ]+\\s +\\)*\\(\"[^\"]+\"\\|[^ ]+\\)" grep-default)
572 (setq grep-default (replace-match tag-default t t 574 (setq grep-default (replace-match tag-default t t
573 grep-default 2))))) 575 grep-default 2)))))
574 (list (read-from-minibuffer "Run grep (like this): " 576 (list (read-from-minibuffer "Run grep (like this): "
575 (or grep-default grep-command) 577 (or grep-default grep-command)
576 nil nil 'grep-history)))) 578 nil nil 'grep-history))))