* macro to invoke shell command
@ 2003-01-10 17:55 ` Peter Lee
2003-01-10 22:26 ` macro help Jesper Harder
2003-01-15 11:08 ` macro to invoke shell command martin
0 siblings, 2 replies; 3+ messages in thread
From: Peter Lee @ 2003-01-10 17:55 UTC (permalink / raw)
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 use grep-find for this.
This doesnt work.
(defun grep-cur-word (&optional arg)
"grep-find on the current word"
(interactive "p")
(grep-find (current-word)))
The defaults for my grep-find are:
find . -iregex ".*\.cpp\|.*\.c\|.*\.h\|.*\.idl\|.*\.rc\|.*\.tl[ih]"
-print0 | xargs -0 -e grep -n -i -e
So normally I would M-x grep-find <ret>
and it would display:
find . -iregex ".*\.cpp\|.*\.c\|.*\.h\|.*\.idl\|.*\.rc\|.*\.tl[ih]"
-print0 | xargs -0 -e grep -n -i -e
Then I just fill in the word at the end enclosed in quotes:
find . -iregex ".*\.cpp\|.*\.c\|.*\.h\|.*\.idl\|.*\.rc\|.*\.tl[ih]"
-print0 | xargs -0 -e grep -n -i -e "m_dwTicks"
My lisp is very weak and would appreciate any help. I just want to be
able to put cursor on word and hit a key to make the above happen.
Any ideas?
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: macro help
2003-01-10 17:55 ` macro to invoke shell command Peter Lee
@ 2003-01-10 22:26 ` Jesper Harder
2003-01-15 11:08 ` macro to invoke shell command martin
1 sibling, 0 replies; 3+ messages in thread
From: Jesper Harder @ 2003-01-10 22:26 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: macro to invoke shell command
2003-01-10 17:55 ` macro to invoke shell command Peter Lee
2003-01-10 22:26 ` macro help Jesper Harder
@ 2003-01-15 11:08 ` martin
1 sibling, 0 replies; 3+ messages in thread
From: martin @ 2003-01-15 11:08 UTC (permalink / raw)
hi,
"PL" == Peter Lee <spam@nospam.org> writes:
PL> Date: Fri, 10 Jan 2003 17:55:11 GMT
8<--------------------------------------------------------------------
PL> (defun grep-cur-word (&optional arg)
PL> "grep-find on the current word"
PL> (interactive "p")
PL> (grep-find (current-word)))
8<--------------------------------------------------------------------
use (grep-find (concat "<your find | grep string>" (current-word)))
martin
--
martin dot fischer at boschrexroth dot de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-15 11:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <usmw0zwfz.fsf@nospam.org>
2003-01-10 17:55 ` macro to invoke shell command Peter Lee
2003-01-10 22:26 ` macro help Jesper Harder
2003-01-15 11:08 ` macro to invoke shell command martin
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).