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 AB8E9431FAF for ; Fri, 6 Sep 2013 14:16:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, 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 valSYYqbky0c for ; Fri, 6 Sep 2013 14:16:48 -0700 (PDT) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id F3BF4431FAE for ; Fri, 6 Sep 2013 14:16:47 -0700 (PDT) Received: by mail-wi0-f177.google.com with SMTP id cb5so1433993wib.10 for ; Fri, 06 Sep 2013 14:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=SxMCAEyFK6h/zLDEJCbxZ0I/5hgbjBd3YCUszpLZNgs=; b=euPEjMdfqB16V26VRQkemTyg0wz6OBGgtRTXyzUAMIOPrYcekAESkxUu/TlLHMMP60 hyaFbTnN2L3T/HTkEn6HdW0E6yyOTLmcUAN1FQlr3h/lAIc6oCcPJdP7NuDClsmN9IvL o3DZcADmtWsq/SaoHJGyhS5bNeRVUzqCwr9GLWu1lIFOc/kLUrv6o1fyUxvmzj0qUW+y Js+qnax1+yVnsU2kI9LQplvyups01yCLNy9e2b93Mu9A+9UpXKkVLQZJh1foJCGLWXT/ Ytyylc6Z/+a22W9bWDfRp7ClJqBDDZwTYlDoF9AsiGsAxQzj7MNJoCDfLgbNpHJ3gkcG LkxA== X-Received: by 10.180.19.196 with SMTP id h4mr3539696wie.38.1378502205345; Fri, 06 Sep 2013 14:16:45 -0700 (PDT) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id i12sm443431wiw.3.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 06 Sep 2013 14:16:44 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH] emacs: show: stop stderr appearing in buffer Date: Fri, 6 Sep 2013 22:16:38 +0100 Message-Id: <1378502198-7980-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 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: Fri, 06 Sep 2013 21:16:55 -0000 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, otoh we can't easily tell when we have got all the error output so can't wait until the process is complete. This patch just takes the simplest approach and discards the error output (which means the behaviour is the same as it was with emacs pre 24.3). --- As I say above it would be nice to capture the error output but it does not appear to be simple. This is probably worth applying in the meantime as we definitely don't want the stderr/stdout appearing in the show buffer. The bug is easy to reproduce: make a script which outputs to stderr or stdout and call it on any part with ". o scriptname" (in fact even ". o ls" will do!) Best wishes Mark emacs/notmuch-show.el | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 904b98e..42438ba 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -2044,9 +2044,12 @@ 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))) - (unwind-protect - (funcall fn handle) - (kill-buffer (mm-handle-buffer handle))))) + ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we + ;; call it from a temp-buffer. + (with-temp-buffer + (unwind-protect + (funcall fn handle) + (kill-buffer (mm-handle-buffer handle)))))) (defun notmuch-show-part-button-default (&optional button) (interactive) -- 1.7.9.1