aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2002-06-14 14:00:07 +0000
committerKim F. Storm2002-06-14 14:00:07 +0000
commitdafe5452823ab1dab7793c9503effaaa6350a78e (patch)
tree7f70391029b14b97015977a9bf7fb17858d48c1b
parent7363941790d8c72ff83322bf5e4f327ff4d1af6e (diff)
downloademacs-dafe5452823ab1dab7793c9503effaaa6350a78e.tar.gz
emacs-dafe5452823ab1dab7793c9503effaaa6350a78e.zip
(grep-tree): Doc fixes.
Added SUBDIRS arg for non-interactive use.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/compile.el21
2 files changed, 22 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6f8eb87a388..67dbd77bacb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12002-06-14 Kim F. Storm <storm@filanet.dk>
2
3 * progmodes/compile.el (grep-tree): Doc fixes.
4 Added SUBDIRS arg for non-interactive use.
5
12002-06-14 Juanma Barranquero <lektu@terra.es> 62002-06-14 Juanma Barranquero <lektu@terra.es>
2 7
3 * comint.el (comint-snapshot-last-prompt): Bind 8 * comint.el (comint-snapshot-last-prompt): Bind
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 7a759f1e2ef..54c5523fed1 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -860,14 +860,23 @@ easily repeat a find command."
860(defvar grep-tree-last-regexp "") 860(defvar grep-tree-last-regexp "")
861(defvar grep-tree-last-files (car (car grep-tree-files-aliases))) 861(defvar grep-tree-last-files (car (car grep-tree-files-aliases)))
862 862
863(defun grep-tree (regexp files dir) 863(defun grep-tree (regexp files dir &optional subdirs)
864 "Grep in directory tree with simplified prompting for search parameters. 864 "Grep for REGEXP in FILES in directory tree rooted at DIR.
865Collect output in a buffer. 865Collect output in a buffer.
866Interactively, prompt separately for each search parameter.
867With prefix arg, reuse previous REGEXP.
868The search is limited to file names matching shell pattern FILES.
869FILES may use abbreviations defined in `grep-tree-files-aliases', e.g.
870entering `ch' is equivalent to `*.[ch]'.
871
866While find runs asynchronously, you can use the \\[next-error] command 872While find runs asynchronously, you can use the \\[next-error] command
867to find the text that grep hits refer to. 873to find the text that grep hits refer to.
868 874
869This command uses a special history list for its arguments, so you can 875This command uses a special history list for its arguments, so you can
870easily repeat a find command." 876easily repeat a find command.
877
878When used non-interactively, optional arg SUBDIRS limits the search to
879those sub directories of DIR."
871 (interactive 880 (interactive
872 (let* ((regexp 881 (let* ((regexp
873 (if current-prefix-arg 882 (if current-prefix-arg
@@ -896,7 +905,11 @@ easily repeat a find command."
896 grep-tree-command 905 grep-tree-command
897 (setq grep-tree-last-regexp regexp) 906 (setq grep-tree-last-regexp regexp)
898 (and files (concat "-name '" files "'")) 907 (and files (concat "-name '" files "'"))
899 nil ;; we change default-directory to dir 908 (if subdirs
909 (if (stringp subdirs)
910 subdirs
911 (mapconcat 'identity subdirs " "))
912 nil) ;; we change default-directory to dir
900 (and grep-tree-ignore-CVS-directories "-path '*/CVS' -prune -o ") 913 (and grep-tree-ignore-CVS-directories "-path '*/CVS' -prune -o ")
901 grep-tree-ignore-case)) 914 grep-tree-ignore-case))
902 (default-directory dir) 915 (default-directory dir)