From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 67837@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#67837: 29.1.90; inhibit-interaction breaks keyboard macros
Date: Fri, 15 Dec 2023 15:09:59 -0500 [thread overview]
Message-ID: <ier5y0zkz1k.fsf@janestreet.com> (raw)
In-Reply-To: <83jzpfnsle.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Dec 2023 22:01:01 +0200")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 67837@debbugs.gnu.org,
>> larsi@gnus.org
>> Date: Fri, 15 Dec 2023 14:48:51 -0500
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > Please explain why you are removing the calls to
>> > barf_if_interaction_inhibited from many functions. It looks like they
>> > will now do some work instead of barfing right at the beginning. Why
>> > is that TRT?
>>
>> Those calls to barf_if_interaction_inhibited meant inhibit-interaction
>> was checked before the keyboard macro code had a chance to provide
>> input.
>>
>> I am moving the check on inhibit-interaction to run after checking
>> executing-kbd-macro in the low-level input handling mechanism,
>> read_char.
>
> I'm saying that your proposal of fixing this will cause these
> functions to do some parts of their jobs before they realize that they
> can barf, and this will now happen even when they run not from a
> keyboard macro, and even if the keyboard macro doesn't actually
> provide any input. This is definitely not TRT. It affects use cases
> completely unrelated to the ones you wanted to fix, and affects them
> in adverse ways.
I think the effects on other use cases are only positive. If, for
example, read-char would fail due to reasons other than
inhibit-interaction, it will now fail for those reasons. Which is good,
because it reduces the need for all code everywhere to think about the
possibility that inhibit-interaction is non-nil.
>> This allows the keyboard macro is allowed to provide input even if
>> inhibit-interaction=t.
>
> Please find a way of fixing the case of a keyboard macro that provides
> input without adversely affecting the other cases where these
> functions are called with inhibit-interaction=t.
How about if those original barf_if_interaction_inhibited calls only
signal if executing-kbd-macro is nil?
>> > And I don't think I understand why we should care about a case when
>> > inhibit-interaction is non-nil, and Emacs needs to execute a keyboard
>> > macro, since executing keyboard macros is basically similar to
>> > interactive invocations of commands. What are the real-life use cases
>> > for that?
>>
>> Two concrete, real-life use cases:
>>
>> - Users write functions using keyboard macros and put them in hooks,
>> which happen to get invoked by packages which use inhibit-interaction.
>> Those functions don't actually require interaction, but because they
>> break, ultimately no code can use inhibit-interaction.
>>
>> - I run tests in a batch Emacs, frequently using keyboard macros to
>> provide input. Sometimes a bug causes code to run which calls
>> read-char outside of a keyboard macro. I would like such read-char
>> calls to error (instead of hanging, which is what they do by default
>> in batch mode). If I bind inhibit-interaction=t, then read-char will
>> exit with an error, but my keyboard macros will also immediately
>> error.
>
> In both cases, using a function would solve the problem. So I'm not
> convinced we need to support those marginal cases, unless you can come
> up with a solution that will be both simple and will not affect
> unrelated use cases.
- Are you suggesting that novice users should have to rewrite all their
keyboard macros in Lisp? That sounds impractical.
- How can I provide keyboard input to the interactive spec of a command
I am testing, other than by using keyboard macros? I'd be pleased to
have an alternative solution.
next prev parent reply other threads:[~2023-12-15 20:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 16:48 bug#67837: 29.1.90; inhibit-interaction breaks keyboard macros Spencer Baugh
2023-12-15 16:50 ` Spencer Baugh
2023-12-15 18:54 ` Eli Zaretskii
2023-12-15 19:48 ` Spencer Baugh
2023-12-15 20:01 ` Eli Zaretskii
2023-12-15 20:09 ` Spencer Baugh [this message]
2023-12-16 7:02 ` Eli Zaretskii
2023-12-16 13:22 ` sbaugh
2023-12-16 13:57 ` Eli Zaretskii
2023-12-15 20:14 ` Eli Zaretskii
2023-12-15 20:39 ` Spencer Baugh
2023-12-16 7:14 ` Eli Zaretskii
2023-12-16 15:52 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-16 16:08 ` Eli Zaretskii
2023-12-16 17:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-16 22:26 ` Spencer Baugh
2024-02-16 23:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-17 7:53 ` Eli Zaretskii
2024-02-17 14:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-17 14:35 ` Eli Zaretskii
2024-02-17 14:43 ` Eli Zaretskii
2024-02-17 15:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-17 16:07 ` Eli Zaretskii
2024-02-17 7:37 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ier5y0zkz1k.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=67837@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).