From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: using find-grep in emacs Date: Mon, 13 May 2013 20:45:00 -0400 Organization: A noiseless patient Spider Message-ID: References: <3477d0ac-7526-4dd7-bc43-7dca9edb1d23@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1368499388 24198 80.91.229.3 (14 May 2013 02:43:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 May 2013 02:43:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 14 04:43:04 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uc5Cd-0007eK-I2 for geh-help-gnu-emacs@m.gmane.org; Tue, 14 May 2013 04:42:59 +0200 Original-Received: from localhost ([::1]:45940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc5Cd-000694-6i for geh-help-gnu-emacs@m.gmane.org; Mon, 13 May 2013 22:42:59 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Injection-Info: mx05.eternal-september.org; posting-host="b8816fa7300cd668c1c8ea38fc847e8a"; logging-data="5646"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18y6B7gp7/8xw3yWQWYPv4cSRgHbnJKJsw=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) Cancel-Lock: sha1:r+h0pbVrR1wbL0j1r+R3hcD5wp4= sha1:z1wfSj7H5u+xUdj8NOSAef1YZIA= Original-Xref: usenet.stanford.edu gnu.emacs.help:198467 X-Mailman-Approved-At: Mon, 13 May 2013 22:42:43 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90736 Archived-At: Rami A writes: > Hi, > I am trying to setup some default for grep-find in emacs. > I do the following to search in the source code: > M-x find-grep > which give: > find . -type f -exec grep -n {} /dev/null \; > > Now I have to change /dev/null to be the directory which I want to search in. > How is it possible to not do that every time I use find-grep and that it could remember the directory I am specifying. > > Also, How to make it default to search all three file types .h .s .c and nothing else? In emacs 24.2.1 the string is: find . -type f -print0 | "xargs" -0 -e grep -nH -e To only look at .hsc files I'd do: find . -type f -a -name '*.[hsc]' -exec grep -n {} /dev/null \; (Not tested but you should get the idea.) The "." after find is the directory you want to search in, if you don't want to search the current directory, replace the ".". I believe /dev/null is there to convince grep that it should display file names because it is looking at multiple files. -- Dan Espen