Subject: bug#67837: 29.1.90; inhibit-interaction breaks keyboard macros

From: Stefan Monnier <[email-masked]>
Date: Sat, 16 Dec 2023 12:18:48 -0500

>> Basically, I think since our test suite runs just fine in batch, we
>> should be able to run it with inhibit-interaction=t as well (which
>> would fix annoying problems when some test fails and ends up waiting
>> for user input).
> In general, yes.  But the test suite can also be run interactively,

That's fine.  My goal is to bind it in `ert-run-tests-batch-and-exit` or
as close to that as possible.

>> Note that trying to make the whole test suite runs with
>> `inhibit-interaction` non-nil is not at all straightforward, sadly:
>> there are several places where we do call things like `read-event`
>> without providing any keyboard input (i.e. without
>> `unread-command-event` or keyboard macros) and instead use a timeout
>> because this `read-event` is just there to force Emacs to wait while
>> some external process sends us some reply.  Should these be considered
>> "interaction"?  If not, then we open up a whole where some code may call
>> `read-event` with a relatively short timeout within a tight loop where
>> the purpose *is* to get user input and where the timeout is only present
>> to keep something else updated while we wait for that user's input.
>
> I see no reason to insist that everything in the test suite _must_ be
> runnable with inhibit-interaction non-nil.

As mentioned, my motivation is to better handle tests that hang instead
of failing.  It's hard to know beforehand which ones of those tests
will/may do that.  Also, where could we let-bind `inhibit-interaction`
such that it only affects those tests we decide need it?

> The only purpose of the test suite is to test whatever each test is
> testing, there are no other requirements.  The code could be not very
> clean; if it does the job, that is fine from where I stand.

That's my opinion as well, and in my opinion `inhibit-interaction` is
mostly meant for tests, so in my current local patch that tries to make
it work for the whole test suite, I made that variable fairly lenient
(it doesn't signal an error if you `read-event` with a timeout).

        Stefan