From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Search files in a folder Date: Mon, 13 Sep 2010 12:19:23 -0400 Message-ID: <87eicxzkdw.fsf@archdesk.localdomain> References: <8739teiwsq.wl%ucecesf@ucl.ac.uk> <874oduqul6.fsf@archdesk.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=40215 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvBkc-00055o-Ou for emacs-orgmode@gnu.org; Mon, 13 Sep 2010 12:19:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvBkb-0005CL-MD for emacs-orgmode@gnu.org; Mon, 13 Sep 2010 12:19:26 -0400 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:50138) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvBkb-0005CH-Ir for emacs-orgmode@gnu.org; Mon, 13 Sep 2010 12:19:25 -0400 In-Reply-To: (=?utf-8?B?IuuFuOygle2DnCIncw==?= message of "Mon, 13 Sep 2010 16:15:41 +0900") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?B?64W47KCV7YOc?= Cc: emacs-orgmode@gnu.org =EB=85=B8=EC=A0=95=ED=83=9C 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.=20 Prefix argument determines number of lines." (interactive "sSearch for: \nP") (let ((grep-find-ignored-files '("#*" ".#*")) (grep-template (concat "grep -i -nH "=20 (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