From c0a22a027f1badaeca9773488c3b1986a9f5245e Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Wed, 13 Nov 2013 23:58:41 +0200 Subject: [PATCH] Re: [PATCH] emacs: show: stop stderr appearing in buffer --- 06/e44aa918fd92b296e1c4f42e5b5ef3231922be | 134 ++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 06/e44aa918fd92b296e1c4f42e5b5ef3231922be diff --git a/06/e44aa918fd92b296e1c4f42e5b5ef3231922be b/06/e44aa918fd92b296e1c4f42e5b5ef3231922be new file mode 100644 index 000000000..8f487ac2f --- /dev/null +++ b/06/e44aa918fd92b296e1c4f42e5b5ef3231922be @@ -0,0 +1,134 @@ +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 C6A29431FC4 + for ; Wed, 13 Nov 2013 13:58:55 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.023 +X-Spam-Level: +X-Spam-Status: No, score=0.023 tagged_above=-999 required=5 + tests=[HS_INDEX_PARAM=0.023] 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 ndsECL78fGTJ for ; + Wed, 13 Nov 2013 13:58:47 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 7AEA5429E25 + for ; Wed, 13 Nov 2013 13:58:46 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id A4040100033; + Wed, 13 Nov 2013 23:58:41 +0200 (EET) +From: Tomi Ollila +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer +In-Reply-To: <1384333417-13832-1-git-send-email-markwalters1009@gmail.com> +References: <1384333417-13832-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Wed, 13 Nov 2013 21:58:56 -0000 + +On Wed, Nov 13 2013, Mark Walters 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 -- 2.26.2