all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65291: 30.0.50; `inhibit-interaction` is too eager
@ 2023-08-14 15:23 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; only message in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-14 15:23 UTC (permalink / raw)
  To: 65291

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;






^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-14 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-14 15:23 bug#65291: 30.0.50; `inhibit-interaction` is too eager Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.