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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 17 Feb 2024 09:53:33 +0200

> From: Stefan Monnier <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked]
> Date: Fri, 16 Feb 2024 18:27:44 -0500
> 
> IIUC, Eli is opposed to changing the behavior of `inhibit-interaction`,

I'm mostly opposed to making this kind of changes for reasons that are
very weak, and basically are based on a special use case Spencer
bumped into in his practice, a use case that can be resolved in a
different way without any changes.  I'm talking about Spencer's code
which uses keyboard macros for mocking user input.  I've seen no other
justification for these behavior changes.

> If you're interested, here's my WiP patch (which modifies the way
> `inhibit-interaction` behaves).
> 
> The most delicate point might be the change to `sit-for` in batch mode:
> I don't have a clear idea why we use `sleep-for` there and what is the
> impact of using `read-event` instead.

Frankly, I don't understand the underlying ideas here.  And it seems
to include unrelated change(s)?  E.g., what is this about:

> +  defsubr (&Sadjust_point_for_property);
> +  DEFVAR_LISP ("point-adjustment-function",
> +               Vpoint_adjustment_function,
> +               doc: /* Function called to adjust point after commands.
> +This function is run after each command that moved point,
> +unless `disable-point-adjustment' or `global-disable-point-adjustment'
> +is non-nil.  */);
> +  Vpoint_adjustment_function = intern ("adjust-point-for-property");

?

> diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el
> index c202970e0b2..58002d597f0 100644
> --- a/test/lisp/autorevert-tests.el
> +++ b/test/lisp/autorevert-tests.el
> @@ -110,7 +110,7 @@ auto-revert--wait-for-revert
>        (if (and (or file-notify--library
>                     (file-remote-p temporary-file-directory))
>                 (with-current-buffer buffer auto-revert-use-notify))
> -          (read-event nil nil 0.05)
> +          (sit-for 0.05)
>          (sleep-for 0.05)))))

So we are supposed to replace all calls to read-event in our test
suite with sit-for, and to be able to do that, we are now changing how
sit-for behaves in non-interactive sessions?  That sounds like a very
serious incompatible change in behavior for a very weak reason -- the
possibility to run the test suite with inhibit-interaction non-nil.  I
sincerely hope we will not make such changes for such reasons.  If we
do, we shouldn't be surprised that Emacs' stability does not improve
with newer releases.

With all due respect to our test suite, let's not forget that its main
purpose is to allow us to test the various Emacs features.  How we do
that and whether we do it cleanly or not is completely unimportant, as
long as the features get tested and tested well.  It follows that the
needs of the test suite should generally not require any
infrastructure changes in Emacs; instead, we should jump through as
many hoops as needed to test Emacs as it is.