]> git.eshelyaron.com Git - emacs.git/commit
server.el: Avoid nested runs of process filters (bug#71223)
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 30 May 2024 22:28:02 +0000 (18:28 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 1 Jun 2024 17:04:56 +0000 (19:04 +0200)
commit516797ec2827d298ba5604cf98f0049192037de7
tree1c55b2d65e544d7ba828b523233c229edd9e3724
parenta6948991c9068096ff455ae77f8f74cbffd2d6a4
server.el: Avoid nested runs of process filters (bug#71223)

In case we have a "storm" of emacsclient requests coming at the
same time, our process filters ended up running nested within
each other, eating up the stack and causing errors.  Try and be
more careful with our use of `sit-for` in the process filter,
and make sure our process filters are run one at a time.

* lisp/server.el (server--message-sit-for): New function.
(server--process-filter-1): New function, extracted from
`server-process-filter`.  Use `server--message-sit-for` to display the
messages and use `run-with-timer` to delay the `delete-process`.
(server--process-filter-pending, server--process-filter-active): New vars.
(server--process-filter-all-pending): New function.
(server-process-filter): Use them.

(cherry picked from commit 0d7d835902dfaeaae03850fb37e369833bb5664d)
lisp/server.el