all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* custom rgrep with multi dirs
@ 2008-06-14  9:31 Xah
  2008-06-16 15:26 ` Xah
  0 siblings, 1 reply; 4+ messages in thread
From: Xah @ 2008-06-14  9:31 UTC (permalink / raw
  To: help-gnu-emacs

i'd like to write a custome rgrep command so that it greps several
predefined dirs at once.

for example, here's what i like the actualy command to run:

find ~/dir1 ~/dir2 ~/dir3 -name "*html" -exec grep -i -nH -e myStr {} /
dev/null \;

all i want the my-rgrep to ask me is about the myStr. And of course i
want the output in nice usual rgrep output with word highlighted and
file linked.

Any suggestion on how to do that?

... for extra... where would i start to learn about how to get unix
shell output into the format rgrep uses? i.e. hotlink file names and
highlight words. Is there a general api/function or does it involve
detailed programing of text properties etc myself?

Thanks.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom rgrep with multi dirs
  2008-06-14  9:31 custom rgrep with multi dirs Xah
@ 2008-06-16 15:26 ` Xah
  2008-06-17  5:26   ` Kevin Rodgers
       [not found]   ` <mailman.13435.1213680387.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Xah @ 2008-06-16 15:26 UTC (permalink / raw
  To: help-gnu-emacs

I have this function:

(defun xah-find-word-usage (myword)
  "Grep a dir for a word's usage."
  (interactive "sWord to search: ")
  ;;(require 'grep)
  (rgrep myword "*\\.html" "~/web/p")
)

However, if i call if for the first time, i get
“grep-expand-template: Wrong type argument: stringp, nil”.

But if i have used rgrep before in this session, then it works.

I guess i need the (require 'grep) but that didn't help. Any hints?

Thanks.

  Xah
∑ http://xahlee.org/

☄


On Jun 14, 2:31 am, Xah <xah...@gmail.com> wrote:
> i'd like to write a custome rgrep command so that it greps several
> predefined dirs at once.
>
> for example, here's what i like the actualy command to run:
>
> find ~/dir1 ~/dir2 ~/dir3 -name "*html" -exec grep -i -nH -e myStr {} /
> dev/null \;
>
> all i want the my-rgrep to ask me is about the myStr. And of course i
> want the output in nice usual rgrep output with word highlighted and
> file linked.
>
> Any suggestion on how to do that?
>
> ... for extra... where would i start to learn about how to get unix
> shell output into the format rgrep uses? i.e. hotlink file names and
> highlight words. Is there a general api/function or does it involve
> detailed programing of text properties etc myself?
>
> Thanks.
>
>  Xah
> ∑http://xahlee.org/
>
> ☄



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom rgrep with multi dirs
  2008-06-16 15:26 ` Xah
@ 2008-06-17  5:26   ` Kevin Rodgers
       [not found]   ` <mailman.13435.1213680387.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2008-06-17  5:26 UTC (permalink / raw
  To: help-gnu-emacs

Xah wrote:
> I have this function:
> 
> (defun xah-find-word-usage (myword)
>   "Grep a dir for a word's usage."
>   (interactive "sWord to search: ")
>   ;;(require 'grep)
>   (rgrep myword "*\\.html" "~/web/p")
> )
> 
> However, if i call if for the first time, i get
> “grep-expand-template: Wrong type argument: stringp, nil”.
> 
> But if i have used rgrep before in this session, then it works.
> 
> I guess i need the (require 'grep) but that didn't help. Any hints?

Just a guess: call grep-compute-defaults in your interactive form,
just like all the commands defined in grep.el.

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom rgrep with multi dirs
       [not found]   ` <mailman.13435.1213680387.18990.help-gnu-emacs@gnu.org>
@ 2008-06-17  6:50     ` Xah
  0 siblings, 0 replies; 4+ messages in thread
From: Xah @ 2008-06-17  6:50 UTC (permalink / raw
  To: help-gnu-emacs

> > I guess i need the (require 'grep) but that didn't help. Any hints?
>
> Just a guess: call grep-compute-defaults in your interactive form,
> just like all the commands defined in grep.el.

thank you. That's it.

 Xah

On Jun 16, 10:26 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> Xah wrote:
> > I have this function:
>
> > (defun xah-find-word-usage (myword)
> >   "Grep a dir for a word's usage."
> >   (interactive "sWord to search: ")
> >   ;;(require 'grep)
> >   (rgrep myword "*\\.html" "~/web/p")
> > )
>
> > However, if i call if for the first time, i get
> > “grep-expand-template: Wrong type argument: stringp, nil”.
>
> > But if i have used rgrep before in this session, then it works.
>
> > I guess i need the (require 'grep) but that didn't help. Any hints?
>
> Just a guess: call grep-compute-defaults in your interactive form,
> just like all the commands defined in grep.el.
>
> --
> Kevin Rodgers
> Denver, Colorado, USA



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-17  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-14  9:31 custom rgrep with multi dirs Xah
2008-06-16 15:26 ` Xah
2008-06-17  5:26   ` Kevin Rodgers
     [not found]   ` <mailman.13435.1213680387.18990.help-gnu-emacs@gnu.org>
2008-06-17  6:50     ` Xah

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.