unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jesper Harder <harder@myrealbox.com>
Subject: Re: macro help
Date: Fri, 10 Jan 2003 23:26:07 +0100	[thread overview]
Message-ID: <m3hecgmykg.fsf@defun.localdomain> (raw)
In-Reply-To: uwulczy80.fsf@nospam.org

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.

  reply	other threads:[~2003-01-10 22:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <usmw0zwfz.fsf@nospam.org>
2003-01-10 17:55 ` macro to invoke shell command Peter Lee
2003-01-10 22:26   ` Jesper Harder [this message]
2003-01-15 11:08   ` martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3hecgmykg.fsf@defun.localdomain \
    --to=harder@myrealbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).