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 BA5DB431FBD for ; Sun, 26 Jan 2014 11:43:45 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 afNE4Lbply-j for ; Sun, 26 Jan 2014 11:43:41 -0800 (PST) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9FD67431FBC for ; Sun, 26 Jan 2014 11:43:41 -0800 (PST) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1W7VcI-0007iu-Qa; Sun, 26 Jan 2014 19:43:39 +0000 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) (envelope-from ) id 1W7VbP-0002qw-ID; Sun, 26 Jan 2014 19:42:43 +0000 From: Mark Walters To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: add a function to heuristically test if the CLI is configured OK. In-Reply-To: <1390763615-24477-1-git-send-email-david@tethera.net> References: <1390762444-18793-1-git-send-email-david@tethera.net> <1390763615-24477-1-git-send-email-david@tethera.net> User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Sun, 26 Jan 2014 19:41:17 +0000 Message-ID: <87zjmi8raa.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 93.97.24.31 X-QM-Geographic: According to ripencc, this message was delivered by a machine in Britain (UK) (GB). X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: a41b543a202539147caff0551fb3c82a (of first 20000 bytes) X-SpamAssassin-Score: 0.0 X-SpamAssassin-SpamBar: / X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored 0.0 points. Summary of the scoring: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * 0.0 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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 19:43:45 -0000 This version LGTM +1. (Just for the record there was some discussion on irc about switching to the *notmuch errors* buffer but that is more complex and fragile so let's go with this simple and effective solution.) Best wishes Mark On Sun, 26 Jan 2014, David Bremner wrote: > We cache the result so that we can call the function many places > without worrying about the cost. > --- > thanks to Tomi for catching the typos (uncommitted changes on my end). > > emacs/notmuch-lib.el | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el > index 2be409b..140d760 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-sane-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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch