From: Tomi Ollila Date: Sun, 26 Jan 2014 19:54:24 +0000 (+0200) Subject: Re: [PATCH] emacs: add a function to heuristically test if the CLI is configured OK. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5f32f9bb053e00511b921f55248a829d51d914cb;p=notmuch-archives.git Re: [PATCH] emacs: add a function to heuristically test if the CLI is configured OK. --- diff --git a/11/70cc0de284fb9dab0375e82ac1f706e122ca88 b/11/70cc0de284fb9dab0375e82ac1f706e122ca88 new file mode 100644 index 000000000..6c59f0202 --- /dev/null +++ b/11/70cc0de284fb9dab0375e82ac1f706e122ca88 @@ -0,0 +1,96 @@ +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 C82F9431FBD + for ; Sun, 26 Jan 2014 11:54:39 -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 ewJeUWvziG9r for ; + Sun, 26 Jan 2014 11:54:33 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 865AE431FBC + for ; Sun, 26 Jan 2014 11:54:33 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id E1CAF100051; + Sun, 26 Jan 2014 21:54:24 +0200 (EET) +From: Tomi Ollila +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.17+55~g4397960 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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:54:39 -0000 + +On Sun, Jan 26 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). + +Series LGTM. + +Tomi + +> +> 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