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 78307431FC2
\r
6 for <notmuch@notmuchmail.org>; Sun, 26 Jan 2014 10:54:29 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 MBqUtV7TKoZE for <notmuch@notmuchmail.org>;
\r
16 Sun, 26 Jan 2014 10:54:23 -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 56C66431FBC
\r
21 for <notmuch@notmuchmail.org>; Sun, 26 Jan 2014 10:54:23 -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 1W7Uqa-0001qh-Re; Sun, 26 Jan 2014 14:54:20 -0400
\r
25 Received: (nullmailer pid 18836 invoked by uid 1000); Sun, 26 Jan 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH 1/3] emacs: add a function to heuristically test if the CLI
\r
31 Date: Sun, 26 Jan 2014 14:54:02 -0400
\r
32 Message-Id: <1390762444-18793-1-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 1.8.5.2
\r
34 In-Reply-To: <5228989D.8030607@fifthhorseman.net>
\r
35 References: <5228989D.8030607@fifthhorseman.net>
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.13
\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:29 -0000
\r
50 We cache the result so that we can call the function many places
\r
51 without worrying about the cost.
\r
53 emacs/notmuch-lib.el | 11 +++++++++++
\r
54 1 file changed, 11 insertions(+)
\r
56 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
57 index 2be409b..dcdfbdc 100644
\r
58 --- a/emacs/notmuch-lib.el
\r
59 +++ b/emacs/notmuch-lib.el
\r
60 @@ -168,6 +168,17 @@ Otherwise the output will be returned"
\r
61 (notmuch-check-exit-status status (cons notmuch-command args) output)
\r
64 +(defvar notmuch--cli-sane-p nil
\r
65 + "Cache whether the CLI seems to be configured sanely.")
\r
67 +(defun notmuch-cli-sane-p ()
\r
68 + "Return t if the cli seems to be configured sanely."
\r
69 + (unless notmuch--cli-sane-p
\r
70 + (let ((status (call-process notmuch-command nil nil nil
\r
71 + "config" "get" "user.primary_email")))
\r
72 + (setq notmuch--cli-setup-p (= status 0))))
\r
73 + notmuch--cli-sane-p)
\r
75 (defun notmuch-version ()
\r
76 "Return a string with the notmuch version number."
\r