unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer
Date: Wed, 13 Nov 2013 23:58:41 +0200	[thread overview]
Message-ID: <m2bo1oyne6.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1384333417-13832-1-git-send-email-markwalters1009@gmail.com>

On Wed, Nov 13 2013, Mark Walters <markwalters1009@gmail.com> wrote:

> In emacs 24.3+ the stdout/stderr from externally displaying an
> attachment gets inserted into the show buffer. This is caused by
> changes in mm-display-external in mm-decode.el.
>
> Ideally, we would put this output in the notmuch errors buffer but the
> handler is called asynchronously so we don't know when the output will
> appear. Thus if we put it straight into the errors buffer it could get
> interleaved with other errors. Also we can't easily tell when we
> have got all the error output so can't wait until the process is complete.
>
> One solution would be to create a new buffer for the stderr of each
> attachment viewed. Again, since we can't tell when the process has
> finished, we can't close these buffers automatically so this will
> leave lots of buffers around.
>
> Thus we add a debug variable notmuch-show-attachment-debug: it this is
> non-nil we create a new buffer for each viewer; if this variable is
> nil we just use a temp buffer which means all error output is
> discarded (this is the same behaviour as with emacs pre 24.3).
> ---

This patch looks tolerable to me. +1

Tomi

>
> This is a new version of
> id:1378502198-7980-1-git-send-email-markwalters1009@gmail.com I don't
> think there was complete consensus on the right thing to do here but
> most people wanted at least the option of seeing the stderr/stdout.
>
> This keeps the default behaviour the same as before, but adds a debug
> variable to put the stderr/stdout in its own buffer.
>
> Note: I always use emacs 23 so this is not heavily tested.
>
> Best wishes
>
> Mark
>
>
>  emacs/notmuch-show.el |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index f00273a..f9a3344 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -159,6 +159,8 @@ indentation."
>  (make-variable-buffer-local 'notmuch-show-indent-content)
>  (put 'notmuch-show-indent-content 'permanent-local t)
>  
> +(defvar notmuch-show-attachment-debug nil)
> +
>  (defcustom notmuch-show-stash-mlarchive-link-alist
>    '(("Gmane" . "http://mid.gmane.org/")
>      ("MARC" . "http://marc.info/?i=")
> @@ -2089,8 +2091,16 @@ caller is responsible for killing this buffer as appropriate."
>  This ensures that the temporary buffer created for the mm-handle
>  is destroyed when FN returns."
>    (let ((handle (notmuch-show-current-part-handle)))
> +    ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we
> +    ;; call it from a temp-buffer, unless
> +    ;; notmuch-show-attachment-debug is non-nil in which case we put
> +    ;; it in " *notmuch-part*".
>      (unwind-protect
> -	(funcall fn handle)
> +	(if notmuch-show-attachment-debug
> +	    (with-current-buffer (generate-new-buffer " *notmuch-part*")
> +	      (funcall fn handle))
> +	  (with-temp-buffer
> +	    (funcall fn handle)))
>        (kill-buffer (mm-handle-buffer handle)))))
>  
>  (defun notmuch-show-part-button-default (&optional button)
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2013-11-13 21:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13  9:03 [PATCH] emacs: show: stop stderr appearing in buffer Mark Walters
2013-11-13 21:58 ` Tomi Ollila [this message]
2013-11-18 11:35 ` David Bremner
2013-11-18 21:10   ` [PATCH v2] " Mark Walters
  -- strict thread matches above, loose matches on Subject: below --
2013-09-06 21:16 [PATCH] " Mark Walters
2013-09-10 14:12 ` David Bremner
2013-09-12  9:33   ` Mark Walters
2013-09-12 10:56     ` David Bremner
2013-09-12 11:49     ` Tomi Ollila
2013-09-12 12:09       ` Mark Walters
2013-09-12 12:20         ` Tomi Ollila
2013-09-12 15:45           ` Mark Walters
2013-09-13  6:13             ` Tomi Ollila
2013-09-12 14:53     ` Austin Clements
2013-09-12 15:43       ` Mark Walters

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=m2bo1oyne6.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --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).