[PATCH 2/3] emacs: add function notmuch-assert-cli-sane
[notmuch-archives.git] / 8e / a0c28d31b4b742e4e57a1731b13d91bab1415b
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 25458431FBC\r
6         for <notmuch@notmuchmail.org>; Sun, 26 Jan 2014 10:54:31 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id mUuYG27WIx3m for <notmuch@notmuchmail.org>;\r
16         Sun, 26 Jan 2014 10:54:27 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 62854431FBD\r
21         for <notmuch@notmuchmail.org>; Sun, 26 Jan 2014 10:54:27 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tethera.net>)\r
24         id 1W7Uqf-0001qr-3m; Sun, 26 Jan 2014 14:54:25 -0400\r
25 Received: (nullmailer pid 18842 invoked by uid 1000); Sun, 26 Jan 2014\r
26         18:54:21 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH 2/3] emacs: add function notmuch-assert-cli-sane\r
30 Date: Sun, 26 Jan 2014 14:54:03 -0400\r
31 Message-Id: <1390762444-18793-2-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.8.5.2\r
33 In-Reply-To: <1390762444-18793-1-git-send-email-david@tethera.net>\r
34 References: <5228989D.8030607@fifthhorseman.net>\r
35         <1390762444-18793-1-git-send-email-david@tethera.net>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Sun, 26 Jan 2014 18:54:31 -0000\r
49 \r
50 If the CLI seems borked, signal an error, and log a suggestion for the\r
51 user about how to recover.\r
52 ---\r
53  emacs/notmuch-lib.el | 7 +++++++\r
54  1 file changed, 7 insertions(+)\r
55 \r
56 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
57 index dcdfbdc..c195652 100644\r
58 --- a/emacs/notmuch-lib.el\r
59 +++ b/emacs/notmuch-lib.el\r
60 @@ -179,6 +179,13 @@ Otherwise the output will be returned"\r
61        (setq notmuch--cli-setup-p (= status 0))))\r
62    notmuch--cli-sane-p)\r
63  \r
64 +(defun notmuch-assert-cli-sane ()\r
65 +  (unless (notmuch-cli-sane-p)\r
66 +    (notmuch-logged-error\r
67 +     "notmuch cli seems misconfigured or unconfigured."\r
68 +"Perhaps you haven't run \"notmuch setup\" yet? Try running this\r
69 +on the command line, and then retry your notmuch command")))\r
70 +\r
71  (defun notmuch-version ()\r
72    "Return a string with the notmuch version number."\r
73    (let ((long-string\r
74 -- \r
75 1.8.5.2\r
76 \r