all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Espen <despen@verizon.net>
To: help-gnu-emacs@gnu.org
Subject: Re: using find-grep in emacs
Date: Mon, 13 May 2013 20:45:00 -0400	[thread overview]
Message-ID: <icbo8ewfsj.fsf@home.home> (raw)
In-Reply-To: 3477d0ac-7526-4dd7-bc43-7dca9edb1d23@googlegroups.com

Rami A <rami.ammari@gmail.com> 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


  reply	other threads:[~2013-05-14  0:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 23:47 using find-grep in emacs Rami A
2013-05-14  0:45 ` Dan Espen [this message]
2013-05-14  2:36   ` Barry Margolin
2013-05-14 13:31     ` Ludwig, Mark
2013-05-14  4:45   ` Bob Proulx
2013-05-14 11:48     ` Andreas Röhler
2013-05-14 15:27       ` Peter Dyballa
2013-05-14 15:42         ` Bob Proulx
2013-05-14 17:19           ` Andreas Röhler
     [not found]         ` <mailman.25743.1368546134.855.help-gnu-emacs@gnu.org>
2013-05-14 19:41           ` Barry Margolin
2013-05-15 18:25 ` Rami A
2013-05-15 18:49   ` Dan Espen
2013-05-15 18:51   ` Andreas Röhler
     [not found]   ` <mailman.25858.1368643771.855.help-gnu-emacs@gnu.org>
2013-05-15 19:11     ` Rami A
2013-05-15 19:46       ` Andreas Röhler
2013-05-15 21:23         ` Peter Dyballa
2013-05-16  5:10           ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=icbo8ewfsj.fsf@home.home \
    --to=despen@verizon.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.