Wow, It works like a magic! Thank you so much.
I wrote it to my .emacs. Thank you.
Sincerely, Jeongtae
³λΑ€ΕΒ <basil83@gmail.com> 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