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 15:09:59 -0500 Message-ID: References: <83le9vnvnn.fsf@gnu.org> <83jzpfnsle.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="35450"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: larsi@gnus.org, 67837@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 15 21:11:31 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 1rEEWw-00090Y-6H for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Dec 2023 21:11:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEEWV-0007gK-OK; Fri, 15 Dec 2023 15:11:03 -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 1rEEWU-0007gB-NY for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 15:11:02 -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 1rEEWU-0000N6-FL for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 15:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEEWU-000051-Gn for bug-gnu-emacs@gnu.org; Fri, 15 Dec 2023 15:11: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 20:11: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.170267100832691 (code B ref 67837); Fri, 15 Dec 2023 20:11:02 +0000 Original-Received: (at 67837) by debbugs.gnu.org; 15 Dec 2023 20:10:08 +0000 Original-Received: from localhost ([127.0.0.1]:53512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEEVb-0008VC-Kw for submit@debbugs.gnu.org; Fri, 15 Dec 2023 15:10:08 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:55157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEEVZ-0008Ua-FU for 67837@debbugs.gnu.org; Fri, 15 Dec 2023 15:10:06 -0500 In-Reply-To: <83jzpfnsle.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Dec 2023 22:01:01 +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:276284 Archived-At: Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: Stefan Monnier , 67837@debbugs.gnu.org, >> larsi@gnus.org >> Date: Fri, 15 Dec 2023 14:48:51 -0500 >> >> Eli Zaretskii 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.