diff --git a/helm-git-grep.el b/helm-git-grep.el index a3395c3..159978a 100644 --- a/helm-git-grep.el +++ b/helm-git-grep.el @@ -183,8 +183,8 @@ and key of toggle command." (defvar helm-git-grep-history nil "The history list for `helm-git-grep'.") -(defvar helm-git-grep-pathspec-temporary-disabled nil - "Temporary Disabled or not of `helm-git-grep-pathspec'.") +(defvar helm-git-grep-pathspec-available t + "Return t if `helm-git-grep-pathspec' is available in git-grep(1).") (defvar helm-git-grep-doc-order-in-name-header-plist '(pathspec @@ -194,8 +194,7 @@ and key of toggle command." (lambda (doc) (when helm-git-grep-pathspecs (format doc - (if helm-git-grep-pathspec-temporary-disabled - "[disabled]" ""))))) + (if helm-git-grep-pathspec-available "" "[disabled]"))))) basedir (:doc "[helm-git-grep-toggle-base-directory]: base dir[%s]" @@ -229,8 +228,7 @@ newline return an empty string." (defun helm-git-grep-pathspec-args () "Create arguments about pathspec." - (when (and helm-git-grep-pathspecs - (not helm-git-grep-pathspec-temporary-disabled)) + (when (and helm-git-grep-pathspecs helm-git-grep-pathspec-available) (append '("--") helm-git-grep-pathspecs))) (defun helm-git-grep-get-top-dir () @@ -562,8 +560,8 @@ if `helm-git-grep-pathspecs' is not nil." (interactive) (if helm-git-grep-pathspecs (progn - (setq helm-git-grep-pathspec-temporary-disabled - (not helm-git-grep-pathspec-temporary-disabled)) + (setq helm-git-grep-pathspec-available + (not helm-git-grep-pathspec-available)) (helm-git-grep-rerun-with-input)) (message helm-git-grep-pathspec-disabled-message))) diff --git a/test/helm-git-grep-test.el b/test/helm-git-grep-test.el index f2cd1ca..7a15fb2 100644 --- a/test/helm-git-grep-test.el +++ b/test/helm-git-grep-test.el @@ -95,7 +95,7 @@ (let ((helm-git-grep-ignore-case nil) (helm-pattern "helm") (helm-git-grep-pathspecs '("./*" ":!test/**")) - (helm-git-grep-pathspec-temporary-disabled t)) + (helm-git-grep-pathspec-available nil)) (should-equal? (helm-git-grep-args) '("--no-pager" "grep" "-n" "--no-color" "-e" "helm")))) @@ -218,14 +218,14 @@ (mocker-let ((message (m) ((:input `(,helm-git-grep-pathspec-disabled-message))))) (helm-git-grep-temporarily-disable-pathspec))) (let ((helm-git-grep-pathspecs '("./*" ":!test/**"))) - (let ((helm-git-grep-pathspec-temporary-disabled nil)) + (let ((helm-git-grep-pathspec-available nil)) (mocker-let ((helm-git-grep-rerun-with-input () ((:max-occur 1)))) (helm-git-grep-temporarily-disable-pathspec) - (should-equal? helm-git-grep-pathspec-temporary-disabled t))) - (let ((helm-git-grep-pathspec-temporary-disabled t)) + (should-equal? helm-git-grep-pathspec-available t))) + (let ((helm-git-grep-pathspec-available t)) (mocker-let ((helm-git-grep-rerun-with-input () ((:max-occur 1)))) (helm-git-grep-temporarily-disable-pathspec) - (should-equal? helm-git-grep-pathspec-temporary-disabled nil))))) + (should-equal? helm-git-grep-pathspec-available nil))))) (ert-deftest test/helm-git-grep () (mocker-let ((helm-git-grep-1 () ((:output t))))