unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: Austin Clements <amdragon@MIT.EDU>
Cc: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer
Date: Thu, 12 Sep 2013 16:43:28 +0100	[thread overview]
Message-ID: <87eh8uvye7.fsf@qmul.ac.uk> (raw)
In-Reply-To: <20130912145326.GK1426@mit.edu>

On Thu, 12 Sep 2013, Austin Clements <amdragon@MIT.EDU> wrote:
> Quoth Mark Walters on Sep 12 at 10:33 am:
>> 
>> Hi
>> 
>> On Tue, 10 Sep 2013, David Bremner <david@tethera.net> 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

  reply	other threads:[~2013-09-12 15:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06 21:16 [PATCH] emacs: show: stop stderr appearing in buffer Mark Walters
2013-09-10 14:12 ` David Bremner
2013-09-12  9:33   ` Mark Walters
2013-09-12 10:56     ` David Bremner
2013-09-12 11:49     ` Tomi Ollila
2013-09-12 12:09       ` Mark Walters
2013-09-12 12:20         ` Tomi Ollila
2013-09-12 15:45           ` Mark Walters
2013-09-13  6:13             ` Tomi Ollila
2013-09-12 14:53     ` Austin Clements
2013-09-12 15:43       ` Mark Walters [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-11-13  9:03 Mark Walters
2013-11-13 21:58 ` Tomi Ollila
2013-11-18 11:35 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eh8uvye7.fsf@qmul.ac.uk \
    --to=markwalters1009@gmail.com \
    --cc=amdragon@MIT.EDU \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).