From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.help Subject: Re: macro help Date: Fri, 10 Jan 2003 23:26:07 +0100 Organization: http://purl.org/harder/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042238010 23930 80.91.224.249 (10 Jan 2003 22:33:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 10 Jan 2003 22:33:30 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18X7iS-0006Dg-00 for ; Fri, 10 Jan 2003 23:33:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18X7g7-0001D4-02 for gnu-help-gnu-emacs@m.gmane.org; Fri, 10 Jan 2003 17:31:03 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!iad-peer.news.verio.net!news.verio.net!news.tele.dk!news.tele.dk!small.news.tele.dk!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.help X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5340 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5340 Peter Lee writes: > I'm having trouble writing a macro to perform a grep-find > command. Basically I just want to grep the current word in the > buffer. I would like to be able to use grep-find for this. > > This doesn't work. > > (defun grep-cur-word (&optional arg) > "grep-find on the current word" > (interactive "p") > (grep-find (current-word))) > I just want to pass the current-word to grep-find so I can then bind > it to a key. It would save me a lot of typing. Try something like this: (defun grep-cur-word () "grep-find on the current word" (interactive) (unless grep-find-command (grep-compute-defaults)) (grep (concat grep-find-command "\"" (current-word) "\""))) PS: You posted the same question separately to comp.emacs and gnu.emacs.help. Please don't multi-post -- cross-post instead. If you want to post to both groups then include both of them in the Newsgroups header instead of sending identical copies.