[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: custom rgrep with multi dirs
From: |
Xah |
Subject: |
Re: custom rgrep with multi dirs |
Date: |
Mon, 16 Jun 2008 08:26:20 -0700 (PDT) |
User-agent: |
G2/1.0 |
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/
>
> ☄