From: Mark Wooding Date: Mon, 16 Mar 2015 13:46:05 +0000 (+0000) Subject: el/dot-emacs.el: Approximately cromulent `git-grep' command. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/5aa1b95f79523e4fdc509fd623e8d271bceb34f7 el/dot-emacs.el: Approximately cromulent `git-grep' command. Full Emacs grep is much fancier. Maybe it'll get improved later. Maybe someone else will do a proper one. Alas, the thing welded into vc-git is terrible. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 8bb88c3..4601e23 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -3193,6 +3193,19 @@ (defun ssh (host) (interactive "sHost: ") (ansi-term (list "ssh" host) (format "ssh@%s" host))) +(defvar git-grep-command + "env PAGER=cat git grep --no-color -nH -e " + "*The default command for \\[git-grep].") + +(defvar git-grep-history nil) + +(defun git-grep (command-args) + "Run `git grep' with user-specified args and collect output in a buffer." + (interactive + (list (read-shell-command "Run git grep (like this): " + git-grep-command 'git-grep-history))) + (grep command-args)) + ;;;-------------------------------------------------------------------------- ;;; Inferior Emacs Lisp.