[PATCH] emacs: add a function to heuristically test if the CLI is configured OK.
Mark Walters
markwalters1009 at gmail.com
Sun Jan 26 11:41:17 PST 2014
This version LGTM +1.
(Just for the record there was some discussion on irc about switching to
the *notmuch errors* buffer but that is more complex and fragile so
let's go with this simple and effective solution.)
Best wishes
Mark
On Sun, 26 Jan 2014, David Bremner <david at tethera.net> wrote:
> We cache the result so that we can call the function many places
> without worrying about the cost.
> ---
> thanks to Tomi for catching the typos (uncommitted changes on my end).
>
> emacs/notmuch-lib.el | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 2be409b..140d760 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
> --
> 1.8.5.2
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
More information about the notmuch
mailing list