diff options
author | David Bremner <david@tethera.net> | 2014-01-26 14:13:48 -0400 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-01-26 15:10:29 -0400 |
commit | 71d6a405815d8c7894e7241a944ff782eb886245 (patch) | |
tree | 5cc52067939f37666af983666fcc1ece08520b14 /emacs | |
parent | aa57e9d2b8149c6f418f61b5568a5c069125bc76 (diff) |
emacs: add a function to heuristically test if the CLI is configured OK.
We cache the result so that we can call the function many places
without worrying about the cost.
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/notmuch-lib.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2be409b3..140d7603 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -168,6 +168,17 @@ Otherwise the output will be returned" (notmuch-check-exit-status status (cons notmuch-command args) output) output))) +(defvar notmuch--cli-sane-p nil + "Cache whether the CLI seems to be configured sanely.") + +(defun notmuch-cli-sane-p () + "Return t if the cli seems to be configured sanely." + (unless notmuch--cli-sane-p + (let ((status (call-process notmuch-command nil nil nil + "config" "get" "user.primary_email"))) + (setq notmuch--cli-sane-p (= status 0)))) + notmuch--cli-sane-p) + (defun notmuch-version () "Return a string with the notmuch version number." (let ((long-string |