From dafe5452823ab1dab7793c9503effaaa6350a78e Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 14 Jun 2002 14:00:07 +0000 Subject: [PATCH] (grep-tree): Doc fixes. Added SUBDIRS arg for non-interactive use. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/compile.el | 21 +++++++++++++++++---- 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 @@ +2002-06-14 Kim F. Storm + + * progmodes/compile.el (grep-tree): Doc fixes. + Added SUBDIRS arg for non-interactive use. + 2002-06-14 Juanma Barranquero * 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." (defvar grep-tree-last-regexp "") (defvar grep-tree-last-files (car (car grep-tree-files-aliases))) -(defun grep-tree (regexp files dir) - "Grep in directory tree with simplified prompting for search parameters. +(defun grep-tree (regexp files dir &optional subdirs) + "Grep for REGEXP in FILES in directory tree rooted at DIR. Collect output in a buffer. +Interactively, prompt separately for each search parameter. +With prefix arg, reuse previous REGEXP. +The search is limited to file names matching shell pattern FILES. +FILES may use abbreviations defined in `grep-tree-files-aliases', e.g. +entering `ch' is equivalent to `*.[ch]'. + While find runs asynchronously, you can use the \\[next-error] command to find the text that grep hits refer to. This command uses a special history list for its arguments, so you can -easily repeat a find command." +easily repeat a find command. + +When used non-interactively, optional arg SUBDIRS limits the search to +those sub directories of DIR." (interactive (let* ((regexp (if current-prefix-arg @@ -896,7 +905,11 @@ easily repeat a find command." grep-tree-command (setq grep-tree-last-regexp regexp) (and files (concat "-name '" files "'")) - nil ;; we change default-directory to dir + (if subdirs + (if (stringp subdirs) + subdirs + (mapconcat 'identity subdirs " ")) + nil) ;; we change default-directory to dir (and grep-tree-ignore-CVS-directories "-path '*/CVS' -prune -o ") grep-tree-ignore-case)) (default-directory dir) -- 2.39.2