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 > ³λΑ€ΕΒ writes: > > > Suvayu, I read your comment, and googled about what I can't understand. > > > > In Emacs, M-x grep Filename * 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 -i -nH " > (when context > (concat "-C" (number-to-string context))) > " -e "))) > (lgrep search "*org*" "/home/matt/org/"))) > > (global-set-key (kbd "") 'my-org-grep) > --8<---------------cut here---------------end--------------->8--- > > A prefix argument (e.g., C-u 3 ) will change the number of > contextual lines pulled up by the search. > > Best, > Matt >