From 3def1bb0634c1d8d66fe57d2716ebe99d37c48cb Mon Sep 17 00:00:00 2001 From: David Bremner Date: Mon, 27 Jan 2014 14:54:02 +2000 Subject: [PATCH] [PATCH 1/3] emacs: add a function to heuristically test if the CLI is configured OK. --- cb/f077ced3b056cf1a4f61867b3477bd1e8e36b4 | 80 +++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 cb/f077ced3b056cf1a4f61867b3477bd1e8e36b4 diff --git a/cb/f077ced3b056cf1a4f61867b3477bd1e8e36b4 b/cb/f077ced3b056cf1a4f61867b3477bd1e8e36b4 new file mode 100644 index 000000000..22de13dd3 --- /dev/null +++ b/cb/f077ced3b056cf1a4f61867b3477bd1e8e36b4 @@ -0,0 +1,80 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 78307431FC2 + for ; Sun, 26 Jan 2014 10:54:29 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id MBqUtV7TKoZE for ; + Sun, 26 Jan 2014 10:54:23 -0800 (PST) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 56C66431FBC + for ; Sun, 26 Jan 2014 10:54:23 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1W7Uqa-0001qh-Re; Sun, 26 Jan 2014 14:54:20 -0400 +Received: (nullmailer pid 18836 invoked by uid 1000); Sun, 26 Jan 2014 + 18:54:17 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 1/3] emacs: add a function to heuristically test if the CLI + is configured OK. +Date: Sun, 26 Jan 2014 14:54:02 -0400 +Message-Id: <1390762444-18793-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.8.5.2 +In-Reply-To: <5228989D.8030607@fifthhorseman.net> +References: <5228989D.8030607@fifthhorseman.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 26 Jan 2014 18:54:29 -0000 + +We cache the result so that we can call the function many places +without worrying about the cost. +--- + emacs/notmuch-lib.el | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +index 2be409b..dcdfbdc 100644 +--- a/emacs/notmuch-lib.el ++++ b/emacs/notmuch-lib.el +@@ -168,6 +168,17 @@ Otherwise the output will be returned" + (notmuch-check-exit-status status (cons notmuch-command args) output) + output))) + ++(defvar notmuch--cli-sane-p nil ++ "Cache whether the CLI seems to be configured sanely.") ++ ++(defun notmuch-cli-sane-p () ++ "Return t if the cli seems to be configured sanely." ++ (unless notmuch--cli-sane-p ++ (let ((status (call-process notmuch-command nil nil nil ++ "config" "get" "user.primary_email"))) ++ (setq notmuch--cli-setup-p (= status 0)))) ++ notmuch--cli-sane-p) ++ + (defun notmuch-version () + "Return a string with the notmuch version number." + (let ((long-string +-- +1.8.5.2 + -- 2.26.2