[PATCH] emacs: show: stop stderr appearing in buffer

Mark Walters markwalters1009 at gmail.com
Thu Sep 12 08:45:57 PDT 2013


On Thu, 12 Sep 2013, Tomi Ollila <tomi.ollila at iki.fi> wrote:
> On Thu, Sep 12 2013, Mark Walters <markwalters1009 at gmail.com> wrote:
>
>> On Thu, 12 Sep 2013, Tomi Ollila <tomi.ollila at iki.fi> wrote:
>>> On Thu, Sep 12 2013, Mark Walters <markwalters1009 at gmail.com> wrote:
>>>
>>>> Hi
>>>>
>>>> On Tue, 10 Sep 2013, David Bremner <david at 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)
>>>>
>>>> 4) stick with just the temp buffer approach
>>>
>>>
>>> Maybe check whether the temp buffer is empty. if not, use
>>> (buffer-string) & (notmuch-logged-error) to append the message
>>> to the *Notmuch errors* buffer... just that notmuch-logged-error
>>> signals an error which we may not want to do...
>>
>> The problem is that the external part viewer is run asynchronously. So
>> when we get to the decision what to do the buffer has not received any
>> output yet even when the first thing the viewer does is output
>> something.
>>
>> A further complication is that in some cases the viewer might not
>> output things until it is closed and that could be arbitrarily later.
>
> I may not have understood completely -- but the temp buffer has lifetime...
> We could store the timestamp when executing function starts and just
> before the temp buffer is about to be wiped out, do the emptiness check
> and if not empty use the stored timestamp & current time in the message
> to be written to aid the human reader who may want to see the message...

The temp buffer is killed as soon as mm-display-external returns which
is almost instantly as it starts the external viewer asynchronously. The
sentinel for the external viewer (called when the external viewer exits)
sees the calling buffer is dead and just drops the error/output.

So it is not really that the error goes into the temp buffer: it just
doesn't go into the (quite likely still existing) show buffer.

Best wishes

Mark





>
>>
>> Best wishes
>>
>> Mark
>
> Tomi
>
>
>>
>>
>>>
>>> We could unify to "*Notmuch Messages*" and have more functions to 
>>> append data there... somewhat analogous to current *Messages* buffer
>>> just that that one has so much noise...
>>>
>>> Tomi
>>>
>>>
>>>>
>>>> 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.
>>>>
>>>> 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
>>>> _______________________________________________
>>>> notmuch mailing list
>>>> notmuch at notmuchmail.org
>>>> http://notmuchmail.org/mailman/listinfo/notmuch
>> _______________________________________________
>> notmuch mailing list
>> notmuch at notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list