0

I have a working sexp for configuration vc-git-grep:

(setq vc-git-grep-template "git --no-pager grep -n -i -e <R> -- <F>")

Then in dired-mode I evaluate M-x vc-git-grep and everething works as expected.

And then I want to create defun:

(defun Pfedj/vc-git-grep-noncase()
  (interactive)
  (setq vc-git-grep-template "git --no-pager grep -n -i -e <R> -- <F>")
  (vc-git-grep))

When in dired-mode I evaluate

M-x Pfedj/vc-git-grep-template

==> Wrong number of arguments: (1 . 3), 0

How can I fix my function?

1 Answer 1

1

vc-git-grep is an interactive function which prompts, so when you want to call it from your own code you need to use call-interactively, otherwise it expects you to have supplied its required arguments in the call:

(defun Pfedj/vc-git-grep-noncase()
  (interactive)
  (setq vc-git-grep-template "git --no-pager grep -n -i -e <R> -- <F>")
  (call-interactively #'vc-git-grep))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.