magit-grep, how to include or exlude file extensions?
emacs, git, grep, magit
Solution
I have removed `magit-grep`, as it was just a severely crippled version of `rgrep`. `vc-git-grep` is actually an improvement, so you should use that. (Nowadays `magit-grep` is defined as an alias for the vc command, to avoid disturbing anyone who previously used the magit variant. A classic case of "add features by looking what already exists elsewhere and then remove our code" :-)
Problem
I'd like to give some options to magit-grep running it with option `foo` results in ``` git --no-pager grep -n foo ``` I'd like to give options to it ``` git --no-pager grep -n foo (options to include *.html and exclude *.py, etc) ``` It doesn't have to be magit-grep, what's the best git grep solution in emacs? magit-grep ``` (magit-define-command grep (&optional pattern) (interactive) (let ((pattern (or pattern (read-string "git grep: " (shell-quote-argument (grep-tag-default)))))) (with-current-buffer (generate-new-buffer "*Magit Grep*") (let ((default-directory (magit-get-top-dir))) (insert magit-git-executable " " (mapconcat 'identity magit-git-standard-options " ") " grep -n " (shell-quote-argument pattern) "\n\n") (magit-git-insert (list "grep" "--line-number" pattern)) (grep-mode) (pop-to-buffer (current-buffer)))))) ```