--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 6DC16431FAF\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Sep 2013 23:13:29 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 Ub1ZVDkVk9y2 for <notmuch@notmuchmail.org>;\r
+ Thu, 12 Sep 2013 23:13:19 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 76314431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Sep 2013 23:13:18 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 828DF10007D;\r
+ Fri, 13 Sep 2013 09:13:11 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Mark Walters <markwalters1009@gmail.com>,\r
+ David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer\r
+In-Reply-To: <87a9jivya2.fsf@qmul.ac.uk>\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> <87a9jivya2.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.16+76~ga4151ca (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Fri, 13 Sep 2013 09:13:11 +0300\r
+Message-ID: <m2bo3x9rm0.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Fri, 13 Sep 2013 06:13:30 -0000\r
+\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
+>>> On Thu, 12 Sep 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\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
+Actually this option would be better than 4 -- we get some output and we\r
+could test whether this (temporary) solution work. It is also better than\r
+the current when we get output into show buffer. Then -- probably --\r
+sometime aroung 2017-2018 if we've got enough bug reports an be also\r
+annoyed ourselves about it (and no-one else have sent tolerable patches\r
+to fix it) we revisit some other fixes.\r
+\r
+Simplest would be just create the buffer (like *notmuch Async* ;) and\r
+use that. A bit more complex would be to output the start date of\r
+async operation that is started (and maybe create mechanism to keep\r
+this (these) message buffers to a certain upper size).\r
+\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
+Ack. It seems I did not (even) read your original commit message >;)\r
+\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+\r
+Tomi\r