X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=fa35fa9fd89384cd16651bd07c767b32f0080ac1;hb=9ac863c549e8022dc06d73e07d79a74ec7f0569f;hp=2be409b39a1abe1fee91b514ce9f96347eb15644;hpb=39408d0f7d71334c539327db5bbfe248cbab8e82;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2be409b3..fa35fa9f 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -168,6 +168,24 @@ 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-assert-cli-sane () + (unless (notmuch-cli-sane-p) + (notmuch-logged-error + "notmuch cli seems misconfigured or unconfigured." +"Perhaps you haven't run \"notmuch setup\" yet? Try running this +on the command line, and then retry your notmuch command"))) + (defun notmuch-version () "Return a string with the notmuch version number." (let ((long-string @@ -513,7 +531,8 @@ the given type." (if (>= emacs-major-version 24) (defadvice mm-shr (before load-gnus-arts activate) (require 'gnus-art nil t) - (ad-disable-advice 'mm-shr 'before 'load-gnus-arts))) + (ad-disable-advice 'mm-shr 'before 'load-gnus-arts) + (ad-activate 'mm-shr))) (defun notmuch-mm-display-part-inline (msg part nth content-type process-crypto) "Use the mm-decode/mm-view functions to display a part in the