bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65291: 30.0.50; `inhibit-interaction` is too eager


From: Stefan Monnier
Subject: bug#65291: 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;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]