From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#67837: 29.1.90; inhibit-interaction breaks keyboard macros Date: Fri, 15 Dec 2023 11:50:29 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2201"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Lars Ingebrigtsen To: 67837@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 15 17:51:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rEBPI-0000KP-9Y for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Dec 2023 17:51:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEBOz-0004Fz-0B; Fri, 15 Dec 2023 11:51:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rEBOx-0004Fj-Bh for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 11:51:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rEBOw-0006dL-6K for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 11:51:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEBOw-0002wv-5T for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 11:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Dec 2023 16:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67837 X-GNU-PR-Package: emacs Original-Received: via spool by 67837-submit@debbugs.gnu.org id=B67837.170265903711302 (code B ref 67837); Fri, 15 Dec 2023 16:51:02 +0000 Original-Received: (at 67837) by debbugs.gnu.org; 15 Dec 2023 16:50:37 +0000 Original-Received: from localhost ([127.0.0.1]:53402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEBOW-0002wD-RU for submit@debbugs.gnu.org; Fri, 15 Dec 2023 11:50:37 -0500 Original-Received: from mxout6.mail.janestreet.com ([64.215.233.21]:36407) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEBOV-0002vx-1Z for 67837@debbugs.gnu.org; Fri, 15 Dec 2023 11:50:35 -0500 In-Reply-To: (Spencer Baugh's message of "Fri, 15 Dec 2023 11:48:27 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276278 Archived-At: --=-=-= Content-Type: text/plain Patch to fix: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Make-inhibit-interaction-work-properly-with-keyboard.patch >From b0f680393991d9ccbd888be8f754a85775196799 Mon Sep 17 00:00:00 2001 From: Spencer Baugh 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 --=-=-=--