Show
Ignore:
Timestamp:
05/13/06 11:31:18 (3 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/progmodes/grep.el

    r4073 r4079  
    640640entering `ch' is equivalent to `*.[ch]'. 
    641641 
    642 With \\[universal-argument] prefix, allow user to edit the constructed 
    643 shell command line before it is executed. 
    644 With two \\[universal-argument] prefixes, edit and run grep shell command
     642With \\[universal-argument] prefix, you can edit the constructed shell command line 
     643before it is executed. 
     644With two \\[universal-argument] prefixes, directly edit and run `grep-command'
    645645 
    646646Collect output in a buffer.  While grep runs asynchronously, you 
     
    677677                    (read-from-minibuffer "Confirm: " 
    678678                                          command nil nil 'grep-history)) 
    679             (push command grep-history)))) 
     679            (add-to-history 'grep-history command)))) 
    680680      (when command 
    681681        ;; Setting process-setup-function makes exit-message-function work 
     
    688688;;;###autoload 
    689689(defun rgrep (regexp &optional files dir) 
    690   "Recusively grep for REGEXP in FILES in directory tree rooted at DIR. 
     690  "Recursively grep for REGEXP in FILES in directory tree rooted at DIR. 
    691691The search is limited to file names matching shell pattern FILES. 
    692692FILES may use abbreviations defined in `grep-files-aliases', e.g. 
    693693entering `ch' is equivalent to `*.[ch]'. 
    694694 
    695 With \\[universal-argument] prefix, allow user to edit the constructed 
    696 shell command line before it is executed. 
    697 With two \\[universal-argument] prefixes, edit and run grep-find shell command
     695With \\[universal-argument] prefix, you can edit the constructed shell command line 
     696before it is executed. 
     697With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'
    698698 
    699699Collect output in a buffer.  While find runs asynchronously, you 
     
    722722        (if (not (string= regexp grep-find-command)) 
    723723            (compilation-start regexp 'grep-mode)) 
    724       (let* ((default-directory (file-name-as-directory (expand-file-name dir))) 
    725             (command (grep-expand-template 
    726                       grep-find-template 
    727                       regexp 
    728                       (concat "\\( -name " 
    729                               (mapconcat #'shell-quote-argument 
    730                                           (split-string files) 
    731                                           " -o -name ") 
    732                               " \\)") 
    733                        default-directory 
     724      (setq dir (file-name-as-directory (expand-file-name dir))) 
     725      (let ((command (grep-expand-template 
     726                      grep-find-template 
     727                      regexp 
     728                      (concat "\\( -name " 
     729                              (mapconcat #'shell-quote-argument 
     730                                         (split-string files) 
     731                                         " -o -name ") 
     732                              " \\)") 
     733                       dir 
    734734                       (and grep-find-ignored-directories 
    735735                            (concat "\\( -path '*/" 
     
    743743                    (read-from-minibuffer "Confirm: " 
    744744                                          command nil nil 'grep-find-history)) 
    745             (push command grep-find-history)) 
    746           (compilation-start command 'grep-mode)))))) 
     745            (add-to-history 'grep-find-history command)) 
     746          (let ((default-directory dir)) 
     747            (compilation-start command 'grep-mode)) 
     748          ;; Set default-directory if we started rgrep in the *grep* buffer. 
     749          (if (eq next-error-last-buffer (current-buffer)) 
     750              (setq default-directory dir))))))) 
    747751 
    748752