]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: add function notmuch-assert-cli-sane
authorDavid Bremner <david@tethera.net>
Sun, 26 Jan 2014 18:36:37 +0000 (14:36 -0400)
committerDavid Bremner <david@tethera.net>
Sun, 26 Jan 2014 19:10:30 +0000 (15:10 -0400)
If the CLI seems borked, signal an error, and log a suggestion for the
user about how to recover.

emacs/notmuch-lib.el

index 140d7603ce2d191613911ac4e7e96bbdd0685a0c..e6e9f97a0190e371bed66104e40952f74de80589 100644 (file)
@@ -179,6 +179,13 @@ Otherwise the output will be returned"
       (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