From: Spencer Baugh <sbaugh@janestreet.com>
To: 67837@debbugs.gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#67837: 29.1.90; inhibit-interaction breaks keyboard macros
Date: Fri, 15 Dec 2023 11:50:29 -0500 [thread overview]
Message-ID: <ierbkarl8a2.fsf@janestreet.com> (raw)
In-Reply-To: <ieredfnl8dg.fsf@janestreet.com> (Spencer Baugh's message of "Fri, 15 Dec 2023 11:48:27 -0500")
[-- Attachment #1: Type: text/plain, Size: 16 bytes --]
Patch to fix:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-inhibit-interaction-work-properly-with-keyboard.patch --]
[-- Type: text/x-patch, Size: 3487 bytes --]
From b0f680393991d9ccbd888be8f754a85775196799 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Fri, 15 Dec 2023 11:39:24 -0500
Subject: [PATCH] Make inhibit-interaction work properly with keyboard macros
Previously, inhibit-interaction=t prevented keyboard macros from
running, even when those macros did not result in user interaction,
since it was checked before the keyboard macro code had a chance to
provide input.
Now, if there's a running keyboard macro which can provide input, that
keyboard macro is allowed to provide input even if
inhibit-interaction=t. This is achieved by moving the check on
inhibit-interaction to run after checking executing-kbd-macro in the
low-level input handling mechanism, read_char.
inhibit-interaction also suppresses reading from stdin in batch mode,
so we also must add a check on inhibit-interaction to
read_minibuf_noninteractive, which again is only called after checking
executing-kbd-macro.
* src/keyboard.c (read_char): Add call to
barf_if_interaction_inhibited. (bug#67837)
* src/lread.c (Fread_char, Fread_event, Fread_char_exclusive): Remove
call to barf_if_interaction_inhibited.
* src/minibuf.c (Fread_from_minibuffer): Remove call to
barf_if_interaction_inhibited.
(read_minibuf_noninteractive): Add call to barf_if_interaction_inhibited.
---
src/keyboard.c | 5 ++++-
src/lread.c | 6 ------
src/minibuf.c | 5 +++--
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/keyboard.c b/src/keyboard.c
index 81605e75ba2..9ec39c89699 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2632,7 +2632,10 @@ read_char (int commandflag, Lisp_Object map,
executing_kbd_macro_index++;
goto from_macro;
- }
+ } else
+ /* Getting input from a keyboard macro doesn't count as
+ interacting with the user. */
+ barf_if_interaction_inhibited ();
if (!NILP (unread_switch_frame))
{
diff --git a/src/lread.c b/src/lread.c
index 255b6e914d9..154c751cbe9 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -950,8 +950,6 @@ DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0,
{
Lisp_Object val;
- barf_if_interaction_inhibited ();
-
if (! NILP (prompt))
{
cancel_echoing ();
@@ -988,8 +986,6 @@ DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0,
`inhibited-interaction' error. */)
(Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds)
{
- barf_if_interaction_inhibited ();
-
if (! NILP (prompt))
{
cancel_echoing ();
@@ -1027,8 +1023,6 @@ DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3,
{
Lisp_Object val;
- barf_if_interaction_inhibited ();
-
if (! NILP (prompt))
{
cancel_echoing ();
diff --git a/src/minibuf.c b/src/minibuf.c
index 58adde1bf66..bf21a8d9cad 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -316,6 +316,9 @@ read_minibuf_noninteractive (Lisp_Object prompt, bool expflag,
struct emacs_tty etty;
bool etty_valid UNINIT;
+ /* inhibit-interaction also prevents reading from stdin. */
+ barf_if_interaction_inhibited ();
+
/* Check, whether we need to suppress echoing. */
if (CHARACTERP (Vread_hide_char))
hide_char = XFIXNAT (Vread_hide_char);
@@ -1344,8 +1347,6 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuffer,
{
Lisp_Object histvar, histpos, val;
- barf_if_interaction_inhibited ();
-
CHECK_STRING (prompt);
if (NILP (keymap))
keymap = Vminibuffer_local_map;
--
2.39.3
next prev parent reply other threads:[~2023-12-15 16:50 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ierbkarl8a2.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=67837@debbugs.gnu.org \
--cc=larsi@gnus.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.