From b80628bb1d038eee06bcaaa543138e913ed3132a Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Thu, 3 Jan 2013 22:48:28 +0000 Subject: [PATCH] Re: [PATCH v3] emacs: Use the minibuffer for CLI error reporting --- c1/11cefc46e316ca7be6dbbde303545351fc2465 | 145 ++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 c1/11cefc46e316ca7be6dbbde303545351fc2465 diff --git a/c1/11cefc46e316ca7be6dbbde303545351fc2465 b/c1/11cefc46e316ca7be6dbbde303545351fc2465 new file mode 100644 index 000000000..1e87bc27b --- /dev/null +++ b/c1/11cefc46e316ca7be6dbbde303545351fc2465 @@ -0,0 +1,145 @@ +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 37B97431FAF + for ; Thu, 3 Jan 2013 14:48:34 -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 MRM+y-vI47fW for ; + Thu, 3 Jan 2013 14:48:33 -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 86F21431FAE + for ; Thu, 3 Jan 2013 14:48:33 -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 1TqtaO-0005jG-Ft; Thu, 03 Jan 2013 22:48:28 +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.69) + (envelope-from ) + id 1TqtaO-00010k-3s; Thu, 03 Jan 2013 22:48:28 +0000 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v3] emacs: Use the minibuffer for CLI error reporting +In-Reply-To: <1357249669-9706-1-git-send-email-amdragon@mit.edu> +References: <1357174222-25132-1-git-send-email-amdragon@mit.edu> + <1357249669-9706-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.14+236~g1d0044f (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Thu, 03 Jan 2013 22:48:28 +0000 +Message-ID: <87ehi1j32b.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-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 89f69f0359f86b1dae79bce93e193503 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +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 -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 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: Thu, 03 Jan 2013 22:48:34 -0000 + +On Thu, 03 Jan 2013, Austin Clements wrote: +> We recently switched to popping up a buffer to report CLI errors, but +> this was too intrusive, especially for transient errors and especially +> since we made fewer things ignore errors. This patch changes this to +> display a basic error message in the minibuffer (using Emacs' usual +> error handling path) and, if there are additional details, to log +> these to a separate error buffer and reference the error buffer from +> the minibuffer message. This is more in line with how Emacs typically +> handles errors, but makes the details available to the user without +> flooding them with the details. +> +> Given this split, we pare down the basic message and make it more +> user-friendly, and also make the verbose message even more detailed +> (and more debugging-oriented). +> --- +> +> This version fixes two hard-coded paths in the tests. + + +This version looks good to me but I have one query we may like to +consider. + +At the moment notmuch-call-notmuch-process returns the stderr mixed with +stdout and we might like to separate that out (particularly as the error +message lists stderr and stdout separately and in this case it all gets +called stdout). + +I attach a patch that does this: I am not really familiar with this so I +just took Austin's code from notmuch-call-notmuch-json. + +Austin: obviously feel free to fold this into your patch if you think +appropriate. + +Best wishes + +Mark + +>From b73395c8efb57111bd4de281797004747de6c2ed Mon Sep 17 00:00:00 2001 +From: Mark Walters +Date: Thu, 3 Jan 2013 22:25:02 +0000 +Subject: [PATCH] tweak notmuch-call-notmuch-process + +--- + emacs/notmuch.el | 10 +++++++--- + 1 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index c98a4fe..4f7ee2c 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -540,9 +540,13 @@ If notmuch exits with a non-zero status, output from the process + will appear in a buffer named \"*Notmuch errors*\" and an error + will be signaled." + (with-temp-buffer +- (let ((status (apply #'call-process notmuch-command nil t nil args))) +- (notmuch-check-exit-status status (cons notmuch-command args) +- (buffer-string))))) ++ (let ((err-file (make-temp-file "nmerr"))) ++ (unwind-protect ++ (let ((status (apply #'call-process ++ notmuch-command nil (list t err-file) nil args))) ++ (notmuch-check-exit-status status (cons notmuch-command args) ++ (buffer-string) err-file)) ++ (delete-file err-file))))) + + (defun notmuch-search-set-tags (tags &optional pos) + (let ((new-result (plist-put (notmuch-search-get-result pos) :tags tags))) +-- +1.7.9.1 + -- 2.26.2