From: David Bremner Date: Sun, 26 Jan 2014 18:54:03 +0000 (+2000) Subject: [PATCH 2/3] emacs: add function notmuch-assert-cli-sane X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ec2d7bb2eb726b41138d9b119cd798eba7bc9fd7;p=notmuch-archives.git [PATCH 2/3] emacs: add function notmuch-assert-cli-sane --- diff --git a/8e/a0c28d31b4b742e4e57a1731b13d91bab1415b b/8e/a0c28d31b4b742e4e57a1731b13d91bab1415b new file mode 100644 index 000000000..07f22298d --- /dev/null +++ b/8e/a0c28d31b4b742e4e57a1731b13d91bab1415b @@ -0,0 +1,76 @@ +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 25458431FBC + for ; Sun, 26 Jan 2014 10:54:31 -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 mUuYG27WIx3m for ; + Sun, 26 Jan 2014 10:54:27 -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 62854431FBD + for ; Sun, 26 Jan 2014 10:54:27 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1W7Uqf-0001qr-3m; Sun, 26 Jan 2014 14:54:25 -0400 +Received: (nullmailer pid 18842 invoked by uid 1000); Sun, 26 Jan 2014 + 18:54:21 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 2/3] emacs: add function notmuch-assert-cli-sane +Date: Sun, 26 Jan 2014 14:54:03 -0400 +Message-Id: <1390762444-18793-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.8.5.2 +In-Reply-To: <1390762444-18793-1-git-send-email-david@tethera.net> +References: <5228989D.8030607@fifthhorseman.net> + <1390762444-18793-1-git-send-email-david@tethera.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:31 -0000 + +If the CLI seems borked, signal an error, and log a suggestion for the +user about how to recover. +--- + emacs/notmuch-lib.el | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +index dcdfbdc..c195652 100644 +--- a/emacs/notmuch-lib.el ++++ b/emacs/notmuch-lib.el +@@ -179,6 +179,13 @@ Otherwise the output will be returned" + (setq notmuch--cli-setup-p (= status 0)))) + notmuch--cli-sane-p) + ++(defun notmuch-assert-cli-sane () ++ (unless (notmuch-cli-sane-p) ++ (notmuch-logged-error ++ "notmuch cli seems misconfigured or unconfigured." ++"Perhaps you haven't run \"notmuch setup\" yet? Try running this ++on the command line, and then retry your notmuch command"))) ++ + (defun notmuch-version () + "Return a string with the notmuch version number." + (let ((long-string +-- +1.8.5.2 +