From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: wenbinye@gmail.com Newsgroups: gmane.emacs.help Subject: Re: customize grep-find-command for each invocation Date: 29 Aug 2006 19:00:52 -0700 Organization: http://groups.google.com Message-ID: <1156903252.450557.24900@i3g2000cwc.googlegroups.com> References: <1156881749.776533.238220@p79g2000cwp.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1156905687 19344 80.91.229.2 (30 Aug 2006 02:41:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2006 02:41:27 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 30 04:41:26 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GIG15-0005rQ-Js for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Aug 2006 04:41:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GIG15-0003j1-2o for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Aug 2006 22:41:23 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!i3g2000cwc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: 218.17.227.208 Original-X-Trace: posting.google.com 1156903258 11071 127.0.0.1 (30 Aug 2006 02:00:58 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 30 Aug 2006 02:00:58 +0000 (UTC) In-Reply-To: <1156881749.776533.238220@p79g2000cwp.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Opera/9.01 (X11; Linux i686; U; zh-cn),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: i3g2000cwc.googlegroups.com; posting-host=218.17.227.208; posting-account=3wOHJA0AAAAYp1ktKqTr4LI0QMFE1g-B Original-Xref: shelby.stanford.edu gnu.emacs.help:141430 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:37050 Archived-At: 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.