--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 54BFA431FAF\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Sep 2013 08:46:11 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id uHmGw1dnb4Rp for <notmuch@notmuchmail.org>;\r
+ Thu, 12 Sep 2013 08:46:03 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 2CFCB431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Sep 2013 08:46:03 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1VK95i-0003N1-JP; Thu, 12 Sep 2013 16:46:01 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1VK95i-00008j-8g; Thu, 12 Sep 2013 16:45:58 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, David Bremner <david@tethera.net>,\r
+ notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer\r
+In-Reply-To: <m2d2oe1bad.fsf@guru.guru-group.fi>\r
+References: <1378502198-7980-1-git-send-email-markwalters1009@gmail.com>\r
+ <87r4cwojds.fsf@zancas.localnet> <87ppsepeo9.fsf@qmul.ac.uk>\r
+ <m2vc26p8e4.fsf@guru.guru-group.fi> <87ob7yw8a8.fsf@qmul.ac.uk>\r
+ <m2d2oe1bad.fsf@guru.guru-group.fi>\r
+User-Agent: Notmuch/0.16 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Thu, 12 Sep 2013 16:45:57 +0100\r
+Message-ID: <87a9jivya2.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: d654062aa0fccf184484c15531f8d1d4 (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored 0.0 points. Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * 0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 12 Sep 2013 15:46:11 -0000\r
+\r
+On Thu, 12 Sep 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Thu, Sep 12 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+>\r
+>> On Thu, 12 Sep 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+>>> On Thu, Sep 12 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+>>>\r
+>>>> Hi\r
+>>>>\r
+>>>> On Tue, 10 Sep 2013, David Bremner <david@tethera.net> wrote:\r
+>>>>>> Ideally, we would put this output in the notmuch errors buffer but the\r
+>>>>>> handler is called asynchronously so we don't know when the output will\r
+>>>>>> appear. Thus if we put it straight into the errors buffer it could get\r
+>>>>>> interleaved with other errors, otoh we can't easily tell when we\r
+>>>>>> have got all the error output so can't wait until the process is complete.\r
+>>>>>\r
+>>>>> Hi Mark;\r
+>>>>>\r
+>>>>> I think your patch is OK, but would it be much harder to created a named\r
+>>>>> buffer like *notmuch-view-$message-d* ? (using e.g. the code from\r
+>>>>> notmuch-show). I might make debugging easier.\r
+>>>>\r
+>>>> Yes this is easy. There are several possibilities and I am not sure\r
+>>>> which is best (some are clearly bad but are worth mentioning anyway).\r
+>>>>\r
+>>>> 1) have a single buffer for part errors; this would accumulate stuff and\r
+>>>> output seems to get interleaved so this is probably useless.\r
+>>>>\r
+>>>> 2) have a buffer for each part viewer as you describe.\r
+>>>>\r
+>>>> 3) have a buffer for each part viewer but start its name with a space so\r
+>>>> it doesn't show up in buffer lists but is findable (maybe)\r
+>>>>\r
+>>>> 4) stick with just the temp buffer approach\r
+>>>\r
+>>>\r
+>>> Maybe check whether the temp buffer is empty. if not, use\r
+>>> (buffer-string) & (notmuch-logged-error) to append the message\r
+>>> to the *Notmuch errors* buffer... just that notmuch-logged-error\r
+>>> signals an error which we may not want to do...\r
+>>\r
+>> The problem is that the external part viewer is run asynchronously. So\r
+>> when we get to the decision what to do the buffer has not received any\r
+>> output yet even when the first thing the viewer does is output\r
+>> something.\r
+>>\r
+>> A further complication is that in some cases the viewer might not\r
+>> output things until it is closed and that could be arbitrarily later.\r
+>\r
+> I may not have understood completely -- but the temp buffer has lifetime...\r
+> We could store the timestamp when executing function starts and just\r
+> before the temp buffer is about to be wiped out, do the emptiness check\r
+> and if not empty use the stored timestamp & current time in the message\r
+> to be written to aid the human reader who may want to see the message...\r
+\r
+The temp buffer is killed as soon as mm-display-external returns which\r
+is almost instantly as it starts the external viewer asynchronously. The\r
+sentinel for the external viewer (called when the external viewer exits)\r
+sees the calling buffer is dead and just drops the error/output.\r
+\r
+So it is not really that the error goes into the temp buffer: it just\r
+doesn't go into the (quite likely still existing) show buffer.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+\r
+\r
+>\r
+>>\r
+>> Best wishes\r
+>>\r
+>> Mark\r
+>\r
+> Tomi\r
+>\r
+>\r
+>>\r
+>>\r
+>>>\r
+>>> We could unify to "*Notmuch Messages*" and have more functions to \r
+>>> append data there... somewhat analogous to current *Messages* buffer\r
+>>> just that that one has so much noise...\r
+>>>\r
+>>> Tomi\r
+>>>\r
+>>>\r
+>>>>\r
+>>>> Also, we could have it togglable with some sort of debug flag. In some\r
+>>>> senses 3 is nice but you would probably end up with 10's or even\r
+>>>> hundreds of hidden buffers which seems bad. In 2 you see them so you\r
+>>>> probably kill them as you go but I think they would be pretty\r
+>>>> annoying. A key difference from the accumulated show/search/pick buffers\r
+>>>> is that, at some point, you did want to see those buffers.\r
+>>>>\r
+>>>> Since all these approaches are easy to implement it is really up to us\r
+>>>> which we want.\r
+>>>>\r
+>>>> Any thoughts?\r
+>>>>\r
+>>>> Mark\r
+>>>>\r
+>>>>\r
+>>>>>\r
+>>>>> Of course those buffers would accumulate, along with show, search and\r
+>>>>> pick buffers...\r
+>>>>>\r
+>>>>> Or we could push this as is, and add some debugging facility later like\r
+>>>>> a variable notmuch-view-errors-buffer.\r
+>>>>>\r
+>>>>> d\r
+>>>> _______________________________________________\r
+>>>> notmuch mailing list\r
+>>>> notmuch@notmuchmail.org\r
+>>>> http://notmuchmail.org/mailman/listinfo/notmuch\r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r