Subject: bug#33747: 26.1; process-send-string exceeds max-specpdl-size

From: Markus Triska <[email-masked]>
Date: Fri, 14 Dec 2018 22:23:16 +0100

Eli Zaretskii <[email-masked]> writes:

> stopping everything else, so waiting for input from any source makes
> perfect sense to me.

In this concrete case, I am looking for a way to make Emacs not wait
for, or at least not process, input from a specific process while
sending output to a different process.

For the case I posted, I can alleviate the issue a bit if I set:

    (setq max-specpdl-size 5000)

However, if I then use for example the following definition of
send-to-target instead of the one I posted:

   (defun send-to-target (proc str)
     (if (process-live-p target)
         (process-send-string target str)
       (kill-process source)))

then I get, for the receipe I posted:

    Lisp nesting exceeds ‘max-lisp-eval-depth’

This is unfortunate, because increasing this limit will eventually crash
Emacs. The root cause is that process-send-string triggers the filter of
the same process that caused the filter to be invoked. I find this
unexpected, because the target process is different, and if possible, I
would like a way do prevent this. Could you please consider adding a
feature that prevents triggering the filter in such cases?

Thank you and all the best!
Markus