Subject: Re: bug#13400: 23.4; overlapping process filter calls

From: Stefan Monnier <[email-masked]>
Date: Mon, 05 Aug 2019 14:31:39 -0400

>>> > - "37.9.2 Process Filter Functions" ignores the problem
>>> >   completely. There should be a paragraph clearly stating this
>>> >   problem. Further, it would be nice, if the filter function
>>> >   example could be extended to correctly deal with this problem.
>>> 
>>> I added a mention of the possibility of recursion.  I'm not sure about
>>> making an example (specifically, what is the best way to deal with this
>>> problem?).
>>
>> I agree with Noam's decisions, and think that his patch is fine.
>>
>> Thanks.
>
> Any thoughts about make-buffered-filter?  Leave it up to callers to
> write their own most situation-appropriate version of it?  Add it as an
> example to the manual?  Add it to Emacs?

I'm pretty sure that while there might be use-cases for recursive
invocation of filters, this is a very exceptional situation and the
average programmer will not expect it and would be stumped if/when
it happens.

So the default should be to prevent it, with maybe some way to override
it to cater to the exceptional case where recursive invocation
is to be allowed.

I think we could do that by setting a property on process object during
filter invocation to postpone further filter invocations, and then the
process filter could locally unset this property if it wants to allow
recursive invocations.

        Stefan