diff --git a/emacs.el b/emacs.el index aadedf3..8c1063e 100644 --- a/emacs.el +++ b/emacs.el @@ -1789,23 +1789,21 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (interactive) (require 'grep) (let ((--grep-command-bak grep-command) - (--grep-use-null-device-bak grep-use-null-device) - (grep-command (if (eq 0 - (shell-command "git rev-parse --git-dir")) - "git --no-pager grep -nH -e " - grep-command - ))) - (grep-apply-setting 'grep-command - grep-command) - (grep-apply-setting 'grep-use-null-device - nil) + (--grep-use-null-device-bak grep-use-null-device)) (if (called-interactively-p 'any) - (call-interactively 'grep) - (message "my-grep only allow interactive call.")) - (grep-apply-setting 'grep-command - --grep-command-bak) - (grep-apply-setting 'grep-use-null-device - --grep-use-null-device-bak))) + (progn + (when (eq 0 + (shell-command "git rev-parse --git-dir")) + (grep-apply-setting 'grep-command + "git --no-pager grep -nH -e ") + (grep-apply-setting 'grep-use-null-device + nil)) + (call-interactively 'grep) + (grep-apply-setting 'grep-command + --grep-command-bak) + (grep-apply-setting 'grep-use-null-device + --grep-use-null-device-bak)) + (message "my-grep only allow interactive call.")))) (defun make () "Run \"make -k\" in current directory."