Thanks, but I would like to write it myself...
I will try to get the input from the cursor's position later. For now, I
would like the user to input the text.
So, I tried this:
(defun my-grep (pattern)
"this is my grep - still developing"
(interactive "sEnter the text to search for: ")
(grep -nH -R --include="*.cpp" --include="*.h" --include ="*.c" -e
pattern .)
)
When I type 'M-x my-grep', and input "Good", 'emacs' reports:
my-grep: Symbol's value as variable is void: -nH
I tried 'C-h f grep' and I could not realize what I am doing wrong...
All the help is much appreciated...
Thanks!!
Drew Adams escreveu:
I would like to create a function that would execute:
grep -nH -R --include="*.cpp" --include="*.h" --include ="*.c" -e
"'selected-word'" .
Where 'selected-word' would be the word where the cursor is at (or
below?).
See the code in grep+.el, which does that. See option
`grepp-default-regexp-fn'
and how it is used.
(In addition, if the region is active, `grep' (in grep+.el) puts
quotes around
it and uses that as the search string instead of the cursor word.)
http://www.emacswiki.org/emacs/grep%2b.el (code)
http://www.emacswiki.org/emacs/GrepPlus (doc)