unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH v3] emacs: Use the minibuffer for CLI error reporting
Date: Sun, 06 Jan 2013 16:12:31 -0500	[thread overview]
Message-ID: <87y5g6j9s0.fsf@awakening.csail.mit.edu> (raw)
In-Reply-To: <87ehi1j32b.fsf@qmul.ac.uk>

On Thu, 03 Jan 2013, Mark Walters <markwalters1009@gmail.com> wrote:
> On Thu, 03 Jan 2013, Austin Clements <amdragon@MIT.EDU> 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 <markwalters1009@gmail.com>
> 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

  reply	other threads:[~2013-01-06 21:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-22 20:49 [PATCH] emacs: tweak error buffer handling Mark Walters
2012-12-25 21:05 ` Tomi Ollila
2012-12-26 22:27   ` Mark Walters
2012-12-27 23:04     ` Austin Clements
2012-12-28  9:03       ` Mark Walters
2012-12-28 12:44         ` David Bremner
2012-12-28 19:48           ` [PATCH] emacs: Use the minibuffer for CLI error reporting Austin Clements
2012-12-29 18:00             ` Mark Walters
2013-01-03  0:44               ` Austin Clements
2013-01-03 23:21                 ` David Bremner
2013-01-03  0:50             ` [PATCH v2] " Austin Clements
2013-01-03 21:47               ` [PATCH v3] " Austin Clements
2013-01-03 22:48                 ` Mark Walters
2013-01-06 21:12                   ` Austin Clements [this message]
2013-01-05 21:33                 ` Tomi Ollila
2013-01-07  2:54                 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y5g6j9s0.fsf@awakening.csail.mit.edu \
    --to=amdragon@mit.edu \
    --cc=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).