From 39cb2ea343a2eeec5a8c92e0cfd16784086aedcd Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Thu, 12 Sep 2013 16:43:28 +0100 Subject: [PATCH] Re: [PATCH] emacs: show: stop stderr appearing in buffer --- 40/7bb54676593189429f935d4f0ab97bc0824d98 | 167 ++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 40/7bb54676593189429f935d4f0ab97bc0824d98 diff --git a/40/7bb54676593189429f935d4f0ab97bc0824d98 b/40/7bb54676593189429f935d4f0ab97bc0824d98 new file mode 100644 index 000000000..8b7a73a2d --- /dev/null +++ b/40/7bb54676593189429f935d4f0ab97bc0824d98 @@ -0,0 +1,167 @@ +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 D2C90431FAF + for ; Thu, 12 Sep 2013 08:43:42 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 CvZerD1jMom6 for ; + Thu, 12 Sep 2013 08:43:37 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 6581F431FAE + for ; Thu, 12 Sep 2013 08:43:37 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1VK93K-0001Sf-WD; Thu, 12 Sep 2013 16:43:31 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1VK93K-0007e2-FU; Thu, 12 Sep 2013 16:43:30 +0100 +From: Mark Walters +To: Austin Clements +Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer +In-Reply-To: <20130912145326.GK1426@mit.edu> +References: <1378502198-7980-1-git-send-email-markwalters1009@gmail.com> + <87r4cwojds.fsf@zancas.localnet> <87ppsepeo9.fsf@qmul.ac.uk> + <20130912145326.GK1426@mit.edu> +User-Agent: Notmuch/0.16 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Thu, 12 Sep 2013 16:43:28 +0100 +Message-ID: <87eh8uvye7.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: ff2160dedb053a103ec74db3cc140a9f (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: Tomi Ollila , notmuch@notmuchmail.org +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: Thu, 12 Sep 2013 15:43:43 -0000 + +On Thu, 12 Sep 2013, Austin Clements wrote: +> Quoth Mark Walters on Sep 12 at 10:33 am: +>> +>> Hi +>> +>> On Tue, 10 Sep 2013, David Bremner wrote: +>> >> 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. +>> > +>> > Hi Mark; +>> > +>> > I think your patch is OK, but would it be much harder to created a named +>> > buffer like *notmuch-view-$message-d* ? (using e.g. the code from +>> > notmuch-show). I might make debugging easier. +>> +>> Yes this is easy. There are several possibilities and I am not sure +>> which is best (some are clearly bad but are worth mentioning anyway). +>> +>> 1) have a single buffer for part errors; this would accumulate stuff and +>> output seems to get interleaved so this is probably useless. +>> +>> 2) have a buffer for each part viewer as you describe. +>> +>> 3) have a buffer for each part viewer but start its name with a space so +>> it doesn't show up in buffer lists but is findable (maybe) +> +> 3.5) Say something in the echo area when a viewer terminates with +> output, so it doesn't interrupt the user if they're doing something, +> but the output buffer is still discoverable. Maybe bind C-c ` to show +> the most recently reported output buffer, like what (la)tex-mode and +> others do, and mention this binding in the echo area message. + +The key problem here is that I don't know how to tell when the viewer +terminates. The viewer is run asynchronously and the sentinel for that +process puts the output in the buffer that called mm-display-external +(provided that that buffer is still alive). + +Moreover, the code in mm-display-external seems to do some strange point +moving: + +(when (buffer-live-p outbuf) + (with-current-buffer outbuf + (let ((buffer-read-only nil) + (point (point))) + (forward-line 2) + (mm-insert-inline + handle (with-current-buffer buffer + (buffer-string))) + (goto-char point)))) + +which seems to put this batch of error/output into the buffer two lines +into the previous batch of error/output. + +> +>> 4) stick with just the temp buffer approach +>> +>> Also, we could have it togglable with some sort of debug flag. In some +>> senses 3 is nice but you would probably end up with 10's or even +>> hundreds of hidden buffers which seems bad. In 2 you see them so you +>> probably kill them as you go but I think they would be pretty +>> annoying. A key difference from the accumulated show/search/pick buffers +>> is that, at some point, you did want to see those buffers. +> +> 3.5.1) Don't create a buffer until the command has output (or, easier +> to implement: create the buffer, but kill it on exit if there was no +> output). When starting a new command, kill output buffers from +> no-longer-running viewers that have never been visited (using +> buffer-display-count or buffer-display-time). + +Again this relies on being able to tell when a viewer has finished. If I +can do that then I think I could just put the output as a block in +*notmuch-errors* + +Best wishes + +Mark +> +>> Since all these approaches are easy to implement it is really up to us +>> which we want. +>> +>> Any thoughts? +>> +>> Mark +>> +>> +>> > +>> > Of course those buffers would accumulate, along with show, search and +>> > pick buffers... +>> > +>> > Or we could push this as is, and add some debugging facility later like +>> > a variable notmuch-view-errors-buffer. +>> > +>> > d -- 2.26.2