* Why not a grep-find-simple?
@ 2006-08-18 15:24 Lennart Borgman
2006-08-18 17:05 ` Lennart Borgman
2006-08-19 22:45 ` Kim F. Storm
0 siblings, 2 replies; 4+ messages in thread
From: Lennart Borgman @ 2006-08-18 15:24 UTC (permalink / raw)
I think it would be good to have a more easy to use version of
`grep-find' that asks for the most common parameters. I would suggest:
- Directory
- File name pattern
- Grep pattern
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why not a grep-find-simple?
2006-08-18 15:24 Why not a grep-find-simple? Lennart Borgman
@ 2006-08-18 17:05 ` Lennart Borgman
2006-08-19 22:45 ` Kim F. Storm
1 sibling, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2006-08-18 17:05 UTC (permalink / raw)
Lennart Borgman wrote:
> I think it would be good to have a more easy to use version of
> `grep-find' that asks for the most common parameters. I would suggest:
>
> - Directory
> - File name pattern
> - Grep pattern
No answers yet so I supply a simple version for this:
(defvar grep-find-simple-filepatt-history nil)
(defvar grep-find-simple-grepregexp-history nil)
(defun grep-find-simple(top-dir file-pattern grep-regexp)
"Run grep via find, prompt for commonly used parameters.
This is a simplified interface to `grep-find'. It prompts for
some of the probably most commonly used parameters to that
command:
TOP-DIR is root directory for search.
FILE-PATTERN tells that only file with matching names should be
searched.
GREP-REGEXP is a grep style regular expression that grep should
search for.
FILE-PATTERN and GREP-REGEXP has their own history lists."
(interactive
(list
(read-directory-name "Root directory for search: " nil nil t)
(read-from-minibuffer "File name pattern: "
nil nil nil
'grep-find-simple-filepatt-history)
(read-from-minibuffer "Grep regexp: "
nil nil nil
'grep-find-simple-grepregexp-history)))
(grep-compute-defaults)
(if (not (string-match "-type f " grep-find-command))
(error "Can't find '-type f' in grep-find-command")
(let* ((begin (match-beginning 0))
(end (match-end 0))
(default-directory (file-name-as-directory top-dir))
(grep-find-command
(if (string= "" file-pattern)
(concat grep-find-command grep-regexp)
(concat (substring grep-find-command 0 begin)
"-type f -name '" file-pattern "' "
(substring grep-find-command end)
grep-regexp))))
(if (string= "" grep-regexp)
(message "No grep regexp to search for")
(call-interactively 'grep-find)))))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why not a grep-find-simple?
2006-08-18 15:24 Why not a grep-find-simple? Lennart Borgman
2006-08-18 17:05 ` Lennart Borgman
@ 2006-08-19 22:45 ` Kim F. Storm
2006-08-20 1:15 ` Lennart Borgman
1 sibling, 1 reply; 4+ messages in thread
From: Kim F. Storm @ 2006-08-19 22:45 UTC (permalink / raw)
Cc: Emacs Devel
Lennart Borgman <lennart.borgman.073@student.lu.se> writes:
> I think it would be good to have a more easy to use version of
> grep-find' that asks for the most common parameters. I would suggest:
>
> - Directory
> - File name pattern
> - Grep pattern
Like M-x rgrep ?
(and look at M-x lgrep too)
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why not a grep-find-simple?
2006-08-19 22:45 ` Kim F. Storm
@ 2006-08-20 1:15 ` Lennart Borgman
0 siblings, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2006-08-20 1:15 UTC (permalink / raw)
Cc: Emacs Devel
Kim F. Storm wrote:
> Lennart Borgman <lennart.borgman.073@student.lu.se> writes:
>
>
>> I think it would be good to have a more easy to use version of
>> grep-find' that asks for the most common parameters. I would suggest:
>>
>> - Directory
>> - File name pattern
>> - Grep pattern
>>
>
> Like M-x rgrep ?
>
> (and look at M-x lgrep too)
>
Ah! Very nice! I looked for them but did not remember the discussion
exactly and could not find them. I thought I had misunderstood.
I think "(info) Searching with Grep under Emacs" could be enhanced a bit
to point out that rgrep and lgrep are simplified UI:s. The reference to
find-grep should be removed I think. Maybe just add something like
`rgrep' is a simplified UI to `grep-find'.
in the listing in the beginning of the node?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-08-20 1:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-18 15:24 Why not a grep-find-simple? Lennart Borgman
2006-08-18 17:05 ` Lennart Borgman
2006-08-19 22:45 ` Kim F. Storm
2006-08-20 1:15 ` Lennart Borgman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.