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 14:48:51 -0500 Message-ID: References: <83le9vnvnn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32661"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: larsi@gnus.org, 67837@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 15 20:49:13 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 1rEEBM-0008FR-Tj for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Dec 2023 20:49:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEEBG-0004QI-En; Fri, 15 Dec 2023 14:49:06 -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 1rEEBD-0004PA-Ks for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 14:49: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 1rEEBD-0007nP-C5 for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 14:49:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEEBD-0005Es-DK for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 14:49:03 -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 19:49:03 +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.170266974020103 (code B ref 67837); Fri, 15 Dec 2023 19:49:03 +0000 Original-Received: (at 67837) by debbugs.gnu.org; 15 Dec 2023 19:49:00 +0000 Original-Received: from localhost ([127.0.0.1]:53494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEEBA-0005EA-6x for submit@debbugs.gnu.org; Fri, 15 Dec 2023 14:49:00 -0500 Original-Received: from mxout2.mail.janestreet.com ([38.105.200.79]:56823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEEB7-0005Dp-6O for 67837@debbugs.gnu.org; Fri, 15 Dec 2023 14:48:58 -0500 In-Reply-To: <83le9vnvnn.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Dec 2023 20:54:52 +0200") 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:276282 Archived-At: Eli Zaretskii writes: >> Cc: Lars Ingebrigtsen >> From: Spencer Baugh >> Date: Fri, 15 Dec 2023 11:50:29 -0500 >> >> >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. > > 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. This allows the keyboard macro is allowed to provide input even if inhibit-interaction=t. > > 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. >> + } else > > This is against our style in C sources. Will fix in next patch.