[PATCH 2/3] emacs: add function notmuch-assert-cli-sane

David Bremner david at tethera.net
Sun Jan 26 10:54:03 PST 2014


If the CLI seems borked, signal an error, and log a suggestion for the
user about how to recover.
---
 emacs/notmuch-lib.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index dcdfbdc..c195652 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -179,6 +179,13 @@ Otherwise the output will be returned"
       (setq notmuch--cli-setup-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
-- 
1.8.5.2



More information about the notmuch mailing list