[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: customize grep-find-command for each invocation
From: |
wenbinye |
Subject: |
Re: customize grep-find-command for each invocation |
Date: |
29 Aug 2006 19:00:52 -0700 |
User-agent: |
G2/0.2 |
When you write elisp code, you should always check you call the
function with right
arguments. You can use C-h f to see the arguments needed, or turn on
eldoc-mode,
the arguments will echo automatically.
What is your root value? The local variable should use 'let' bind.
grep-find-command is a string, not a cons cell.
after set grep-find-command, you can use (call-interactively
'grep-find)
or (grep-find grep-find-command) to call grep-find
weiqingh@yahoo.com wrote:
> hi there,
>
> i want to set the grep-find-command differently based on each file.
> (basically i need to search from a certain directory based on where the
> file is). what's the best way to do it? i tried to write a new function
> like this:
>
> (defun rails-search()
> (interactive)
> ;; set grep-find-command based on value of root
> (rails-core:with-root (root)
> (setq grep-find-command (cons (concat "find " root " -name \"*.rb\" |
> xargs -exec grep -i -n -s ") (+ 34 (length root))))
>
> (grep-find)
> )
> )
>
> when trying to run the new function, it gave me "wrong number of
> arguments". i guess i need to pass arguments to grep-find. but how? i
> wanted to grep-find to take the input for search string...
>
> thanks.