我想为 magit-grep 提供一些选项
使用选项运行它会foo
导致
git --no-pager grep -n foo
我想给它选项
git --no-pager grep -n foo (options to include *.html and exclude *.py, etc)
它不一定是 magit-grep,emacs 中最好的 git grep 解决方案是什么?
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))))))