How to grep current word under cursor in emacs?
<p>I am trying to grep current word under cursor in emacs. I have written code below, which throws the error: Wrong number of arguments... When I remove (grep) from xx() and bind it to f4 key (commented last line), after f3 and f4 grep searches word under cursor. Does any one know why (grep) can not be called from xx()?
Thanks, Alex.</p>

<pre><code>(require 'grep)
(defun xx ()
  "setting up grep-command using current word under cursor as a search string"
 (interactive)
 (setq curWord (thing-at-point 'word))
 (setq VALUE   (concat "grep -nH -r --exclude='TAGS' --include='*.h' --include='*.cpp' --include='*.pl' --include='*.c' -e " curWord " /home/alex/code/") )
 (grep-apply-setting 'grep-command VALUE)
 (grep))

 (global-set-key (kbd "&lt;f3&gt;")  'xx)
;(global-set-key (kbd "&lt;f4&gt;") 'grep )
</code></pre>