[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macro help
From: |
Jesper Harder |
Subject: |
Re: macro help |
Date: |
Fri, 10 Jan 2003 23:26:07 +0100 |
User-agent: |
Gnus/5.090011 (Oort Gnus v0.11) Emacs/21.3.50 (i686-pc-linux-gnu) |
Peter Lee <spam@nospam.org> 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.