From 50e979dc5cf13904a83b8f349cb8980b7d678c94 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 7 Jan 2013 16:12:31 +1900 Subject: [PATCH] Re: [PATCH v3] emacs: Use the minibuffer for CLI error reporting --- 72/f60a237cbac9e3ff0962e05ac52c03fc5ec71e | 156 ++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 72/f60a237cbac9e3ff0962e05ac52c03fc5ec71e diff --git a/72/f60a237cbac9e3ff0962e05ac52c03fc5ec71e b/72/f60a237cbac9e3ff0962e05ac52c03fc5ec71e new file mode 100644 index 000000000..aa590d763 --- /dev/null +++ b/72/f60a237cbac9e3ff0962e05ac52c03fc5ec71e @@ -0,0 +1,156 @@ +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 8D21C429E27 + for ; Sun, 6 Jan 2013 13:12:43 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 E-JGUrVOur4V for ; + Sun, 6 Jan 2013 13:12:34 -0800 (PST) +Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU + [18.9.25.12]) + by olra.theworths.org (Postfix) with ESMTP id ABDB1431FD4 + for ; Sun, 6 Jan 2013 13:12:34 -0800 (PST) +X-AuditID: 1209190c-b7fa86d000001d37-9f-50e9e8c22cac +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP + id 38.F7.07479.2C8E9E05; Sun, 6 Jan 2013 16:12:34 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r06LCXuO019829; + Sun, 6 Jan 2013 16:12:34 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id r06LCV2P025193 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Sun, 6 Jan 2013 16:12:33 -0500 (EST) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1TrxWB-0002bC-I2; Sun, 06 Jan 2013 16:12:31 -0500 +From: Austin Clements +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH v3] emacs: Use the minibuffer for CLI error reporting +In-Reply-To: <87ehi1j32b.fsf@qmul.ac.uk> +References: <1357174222-25132-1-git-send-email-amdragon@mit.edu> + <1357249669-9706-1-git-send-email-amdragon@mit.edu> + <87ehi1j32b.fsf@qmul.ac.uk> +User-Agent: Notmuch/0.14+236~gf64406d (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Sun, 06 Jan 2013 16:12:31 -0500 +Message-ID: <87y5g6j9s0.fsf@awakening.csail.mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFupileLIzCtJLcpLzFFi42IR4hTV1j304mWAwYPHPBY3WrsZLfbs87JY + PZfH4vrNmcwOLB53T3N57Jx1l93j2apbzB5bDr1nDmCJ4rJJSc3JLEst0rdL4MrY/u4Ra8EG + qYo326eyNzBOEu1i5OSQEDCRuPpuAQuELSZx4d56NhBbSGAfo8Sf+0A2F5C9nlHiUe9WFgjn + ApPE7Ib/7BDOEkaJjtlXmUFa2AQ0JLbtX84IYosIuEo8/fYZLM4sYCixZdpbdhBbWMBToqWh + DWwFJ1D95DdLWSDWTWCUmLlfHsQWFYiXeH7vG1icRUBVYuq5v2A2L9CpB39PY4WwBSVOznzC + AjFfS+LGv5dMExgFZyFJzUKSWsDItIpRNiW3Sjc3MTOnODVZtzg5MS8vtUjXUC83s0QvNaV0 + EyM4mCV5djC+Oah0iFGAg1GJh/fCzhcBQqyJZcWVuYcYJTmYlER59959GSDEl5SfUpmRWJwR + X1Sak1p8iFGCg1lJhHffMaAcb0piZVVqUT5MSpqDRUmc93LKTX8hgfTEktTs1NSC1CKYrAwH + h5IEb/pzoEbBotT01Iq0zJwShDQTByfIcB6g4YYgNbzFBYm5xZnpEPlTjLocDS9vPGUUYsnL + z0uVEuflegpUJABSlFGaBzcHloReMYoDvSXMawkyigeYwOAmvQJawgS0JPXxc5AlJYkIKakG + RjfP+fnWkeLiOvab42Uu3D33wJuzwCUpXdh9ovLlk4KZF6svmH+3EXSzmu5t4Du77/zF2NDj + 3pIWZgf9eP6mW3z6nsvivcnw26Ur4v4FBcobwrynt+gf+yVQ8+Thxt2yV6yUckPORtv8fFnZ + rl+2b9PXlAyTEtvv0+e/mHnGvPoRo83X+LgGJZbijERDLeai4kQAO9Efhx0DAAA= +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, 06 Jan 2013 21:12:43 -0000 + +On Thu, 03 Jan 2013, Mark Walters wrote: +> 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). + +This sounds like a good idea to me, though I'd rather do it as a +separate patch. Your patch looks good to me (modulo commit message, +obviously). Care to roll an official patch? + +As I mentioned elsewhere, there are several direct calls to notmuch that +don't go through any of this error handling (for example, +`notmuch-call-notmuch-process' is only used in 'notmuch-tag'). It would +be great if Someone (TM) cleaned this up. + +> 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