GNU bug report logs - #65291
30.0.50; `inhibit-interaction` is too eager

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Mon, 14 Aug 2023 15:24:01 UTC

Severity: normal

Merged with 67837

Found in versions 29.1.90, 30.0.50

To reply to this bug, email your comments to 65291 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65291; Package emacs. (Mon, 14 Aug 2023 15:24:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 14 Aug 2023 15:24:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; `inhibit-interaction` is too eager
Date: Mon, 14 Aug 2023 11:23:18 -0400
Package: Emacs
Version: 30.0.50


When `inhibit-interaction` is non-nil, all calls to
`read-from-minibuffer` or `read-event` will signal an error, even when
those calls are carefully wrapped in such a way that they will return
without needing any user interaction, thanks to timeouts,
`unread-command-events`, or whatnot.

The patch below reduces the number of false positives by delaying the
check to the point where we know "for sure" that we will have to wait,
but is still not quite right because it doesn't handle the timeout case :-(


        Stefan


diff --git a/src/keyboard.c b/src/keyboard.c
index 78c88a2859b..ef243bc9b5d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2738,6 +2738,11 @@ read_char (int commandflag, Lisp_Object map,
 	goto exit;
     }
 
+  /* Looks like we really have to wait for interactive user input.
+     FIXME: This still suffers from false positives when `read-event` is
+     called with a time out to wait for things like process output :-(  */
+  barf_if_interaction_inhibited ();
+
   /* Make a longjmp point for quits to use, but don't alter getcjmp just yet.
      We will do that below, temporarily for short sections of code,
      when appropriate.  local_getcjmp must be in effect
diff --git a/src/lread.c b/src/lread.c
index 251da5670d0..893ff70fc62 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -951,8 +951,6 @@ DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0,
 {
   Lisp_Object val;
 
-  barf_if_interaction_inhibited ();
-
   if (! NILP (prompt))
     {
       cancel_echoing ();
@@ -989,8 +987,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 ();
@@ -1028,8 +1024,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..4636ce8f308 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -316,6 +316,8 @@ read_minibuf_noninteractive (Lisp_Object prompt, bool expflag,
   struct emacs_tty etty;
   bool etty_valid UNINIT;
 
+  barf_if_interaction_inhibited ();
+
   /* Check, whether we need to suppress echoing.  */
   if (CHARACTERP (Vread_hide_char))
     hide_char = XFIXNAT (Vread_hide_char);
@@ -1344,8 +1346,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;





Merged 65291 67837. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Sat, 16 Dec 2023 15:53:02 GMT) Full text and rfc822 format available.

Merged 65291 67837. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Sat, 16 Dec 2023 15:54:02 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 181 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.