Almost always, I want to run find-grep like this:
ack --no-heading --no-color "SOMETHING" ~/myco/firmwaresrc
Where SOMETHING is the only variable. There are actually a surprising number of keypresses and bits of thinking required to get this to happen.
How would I go about 'canning' this, so that M-x fgf would run find-grep with that command and the current region in place of SOMETHING?
Actually I've worked out how to do this (see answer below). Can anyone tell me how to get emacs to ask for SOMETHING if there's no selected region?
(defun fgf (term)
(interactive
(list (if (use-region-p)
(buffer-substring (region-beginning) (region-end))
(read-string "grep-find: "))))
(grep-find (concat "ack --no-heading --no-color \""
term "\" ~/myco/firmwaresrc")))