all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: 노정태 <basil83@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Search files in a folder
Date: Mon, 13 Sep 2010 12:19:23 -0400	[thread overview]
Message-ID: <87eicxzkdw.fsf@archdesk.localdomain> (raw)
In-Reply-To: <AANLkTik=uyD=itgu3GLmASHr71rq2WdsTHYG85hthk0H@mail.gmail.com> ("노정태"'s message of "Mon, 13 Sep 2010 16:15:41 +0900")

노정태 <basil83@gmail.com> writes:

> Suvayu, I read your comment, and googled about what I can't understand.
>
> In Emacs, M-x grep <RET> Filename * <RET> does what I want. Thank you.
>
> And now, I want to make it as one elisp command.
>
> What should I do? Can anybody write a simple script?

FWIW, here's my elisp function to search all my org files with lgrep:

--8<---------------cut here---------------start------------->8---
  (defun my-org-grep (search &optional context)
    "Search for word in org files. 

Prefix argument determines number of lines."
    (interactive "sSearch for: \nP")
    (let ((grep-find-ignored-files '("#*" ".#*"))
	  (grep-template (concat "grep <X> -i -nH " 
				 (when context
				   (concat "-C" (number-to-string context)))
				 " -e <R> <F>")))
      (lgrep search "*org*" "/home/matt/org/")))

  (global-set-key (kbd "<f8>") 'my-org-grep)
--8<---------------cut here---------------end--------------->8---

A prefix argument (e.g., C-u 3 <f8>) will change the number of
contextual lines pulled up by the search.

Best,
Matt

  reply	other threads:[~2010-09-13 16:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-12 19:11 Search files in a folder 노정태
2010-09-12 19:31 ` Eric S Fraga
2010-09-12 20:29   ` suvayu ali
2010-09-13  1:51   ` Matt Lundin
2010-09-13  4:09     ` 노정태
2010-09-13  4:22       ` suvayu ali
2010-09-13  7:15         ` 노정태
2010-09-13 16:19           ` Matt Lundin [this message]
2010-09-14 16:06             ` 노정태
2010-09-20  8:31             ` Bastien

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=87eicxzkdw.fsf@archdesk.localdomain \
    --to=mdl@imapmail.org \
    --cc=basil83@gmail.com \
    --cc=emacs-orgmode@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.