|
From: | 노정태 |
Subject: | [Orgmode] Re: Search files in a folder |
Date: | Wed, 15 Sep 2010 01:06:25 +0900 |
노정태 <address@hidden> writes:FWIW, here's my elisp function to search all my org files with lgrep:
> 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?
--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
[Prev in Thread] | Current Thread | [Next in Thread] |