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: 노정태
Subject: [Orgmode] Re: Search files in a folder
Date: Wed, 15 Sep 2010 01:06:25 +0900

Wow, It works like a magic! Thank you so much.

I wrote it to my .emacs. Thank you.

Sincerely, Jeongtae



2010/9/14 Matt Lundin <address@hidden>
노정태 <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]