I have the following custom function in ~/.emacs:
(defun xi-rgrep (term)
(grep-compute-defaults)
(interactive "sSearch Term: ")
(rgrep term "*.[ch]*" "../"))
This function just runs rgrep for the term entered in the files/directories I'm interested in. However, I want to match the original rgrep functionality of having the default search term be the word at the point (I think that's the term?). How do I achieve this? I've tried several things, including running (grep-read-regexp) but haven't been successful.
You can use the 'thingatpt package like so:
(require 'thingatpt)
(defun xi-rgrep (term)
(interactive (list (completing-read "Search Term: " nil nil nil (thing-at-point 'word))))
(grep-compute-defaults)
(rgrep term "*.[ch]*" "../"))