]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: hello: make --batch error gracefully
authorMark Walters <markwalters1009@gmail.com>
Thu, 4 Jul 2013 22:18:19 +0000 (23:18 +0100)
committerDavid Bremner <bremner@debian.org>
Sat, 27 Jul 2013 21:22:37 +0000 (18:22 -0300)
Recently notmuch-hello was converted to use batch count. However, it
seems that several people run different versions of notmuch-emacs and
notmuch-cli so this batch makes emacs fail with an error message if
--batch is not available in the CLI.

Amended by: db

emacs/notmuch-hello.el

index 147c08cc2079c41c5bdc72da2366db8af65f3041..9db8c9931a8fee0a25e105d00d5345def45ec47f 100644 (file)
@@ -402,8 +402,13 @@ options will be handled as specified for
                                           (plist-get options :filter)))
         "\n")))
 
-    (call-process-region (point-min) (point-max) notmuch-command
-                        t t nil "count" "--batch")
+    (unless (= (call-process-region (point-min) (point-max) notmuch-command
+                                   t t nil "count" "--batch") 0)
+      (notmuch-logged-error "notmuch count --batch failed"
+                           "Please check that the notmuch CLI is new enough to support `count
+--batch'. In general we recommend running matching versions of
+the CLI and emacs interface."))
+
     (goto-char (point-min))
 
     (notmuch-remove-if-not