emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Search files in a folder


From: Matt Lundin
Subject: [Orgmode] Re: Search files in a folder
Date: Mon, 13 Sep 2010 12:19:23 -0400
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

노정태 <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]