Re: [PATCH] emacs: show: stop stderr appearing in buffer
authorMark Walters <markwalters1009@gmail.com>
Thu, 12 Sep 2013 15:43:28 +0000 (16:43 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:06 +0000 (09:57 -0800)
40/7bb54676593189429f935d4f0ab97bc0824d98 [new file with mode: 0644]

diff --git a/40/7bb54676593189429f935d4f0ab97bc0824d98 b/40/7bb54676593189429f935d4f0ab97bc0824d98
new file mode 100644 (file)
index 0000000..8b7a73a
--- /dev/null
@@ -0,0 +1,167 @@
+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 D2C90431FAF\r
+       for <notmuch@notmuchmail.org>; Thu, 12 Sep 2013 08:43:42 -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 CvZerD1jMom6 for <notmuch@notmuchmail.org>;\r
+       Thu, 12 Sep 2013 08:43:37 -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 6581F431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 12 Sep 2013 08:43:37 -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 1VK93K-0001Sf-WD; Thu, 12 Sep 2013 16:43:31 +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 1VK93K-0007e2-FU; Thu, 12 Sep 2013 16:43:30 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Austin Clements <amdragon@MIT.EDU>\r
+Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer\r
+In-Reply-To: <20130912145326.GK1426@mit.edu>\r
+References: <1378502198-7980-1-git-send-email-markwalters1009@gmail.com>\r
+       <87r4cwojds.fsf@zancas.localnet> <87ppsepeo9.fsf@qmul.ac.uk>\r
+       <20130912145326.GK1426@mit.edu>\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:43:28 +0100\r
+Message-ID: <87eh8uvye7.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: ff2160dedb053a103ec74db3cc140a9f (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
+Cc: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\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:43:43 -0000\r
+\r
+On Thu, 12 Sep 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> Quoth Mark Walters on Sep 12 at 10:33 am:\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
+> 3.5) Say something in the echo area when a viewer terminates with\r
+> output, so it doesn't interrupt the user if they're doing something,\r
+> but the output buffer is still discoverable.  Maybe bind C-c ` to show\r
+> the most recently reported output buffer, like what (la)tex-mode and\r
+> others do, and mention this binding in the echo area message.\r
+\r
+The key problem here is that I don't know how to tell when the viewer\r
+terminates. The viewer is run asynchronously and the sentinel for that\r
+process puts the output in the buffer that called mm-display-external\r
+(provided that that buffer is still alive).\r
+\r
+Moreover, the code in mm-display-external seems to do some strange point\r
+moving:\r
+\r
+(when (buffer-live-p outbuf)\r
+  (with-current-buffer outbuf\r
+    (let ((buffer-read-only nil)\r
+         (point (point)))\r
+      (forward-line 2)\r
+      (mm-insert-inline\r
+       handle (with-current-buffer buffer\r
+               (buffer-string)))\r
+      (goto-char point))))\r
+\r
+which seems to put this batch of error/output into the buffer two lines\r
+into the previous batch of error/output. \r
+\r
+>\r
+>> 4) stick with just the temp buffer approach\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
+> 3.5.1) Don't create a buffer until the command has output (or, easier\r
+> to implement: create the buffer, but kill it on exit if there was no\r
+> output).  When starting a new command, kill output buffers from\r
+> no-longer-running viewers that have never been visited (using\r
+> buffer-display-count or buffer-display-time).\r
+\r
+Again this relies on being able to tell when a viewer has finished. If I\r
+can do that then I think I could just put the output as a block in\r
+*notmuch-errors*\r
+\r
+Best wishes\r
+\r
+Mark\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