help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

macro to invoke shell command


From: Peter Lee
Subject: macro to invoke shell command
Date: Fri, 10 Jan 2003 17:55:11 GMT
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]