Skip to content

Commit

Permalink
Rename to helm-git-grep-pathspec-available
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuyk committed Oct 11, 2016
1 parent ef54c7a commit 97452df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
14 changes: 6 additions & 8 deletions helm-git-grep.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]"
Expand Down Expand Up @@ -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 ()
Expand Down Expand Up @@ -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)))

Expand Down
10 changes: 5 additions & 5 deletions test/helm-git-grep-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -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"))))

Expand Down Expand Up @@ -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))))
Expand Down

0 comments on commit 97452df

Please sign in to comment.