Subject: Re: bug#5680: 23.1; canot quit infloop by C-g

From: Stefan Monnier <[email-masked]>
Date: Fri, 05 Mar 2010 18:10:57 -0500

>>>>> "ARISAWA" == ARISAWA Akihiro <[email-masked]> writes:

> Hi developers,
> When I evaluate following code and type C-g, I cannot quit a infinity loop.

> (funcall (byte-compile (lambda () (while t))))

> In Emacs-22, I can quit it.

Indeed, thanks.  I've just installed the patch below which should fix
this problem.

        Stefan

=== modified file 'src/bytecode.c'
--- src/bytecode.c	2010-01-13 08:35:10 +0000
+++ src/bytecode.c	2010-03-05 23:01:01 +0000
@@ -393,6 +393,7 @@
 	Fsignal (Qquit, Qnil);				\
 	AFTER_POTENTIAL_GC ();				\
       }							\
+    ELSE_PENDING_SIGNALS				\
   } while (0)

=== modified file 'src/lisp.h'
--- src/lisp.h	2010-01-22 09:10:04 +0000
+++ src/lisp.h	2010-03-05 23:03:16 +0000
@@ -1933,22 +1933,12 @@
 #ifdef SYNC_INPUT
 extern void process_pending_signals P_ ((void));
 extern int pending_signals;
-
-#define QUIT						\
-  do {							\
-    if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))	\
-      {							\
-        Lisp_Object flag = Vquit_flag;			\
-	Vquit_flag = Qnil;				\
-	if (EQ (Vthrow_on_input, flag))			\
-	  Fthrow (Vthrow_on_input, Qt);			\
-	Fsignal (Qquit, Qnil);				\
-      }							\
+#define ELSE_PENDING_SIGNALS				\
     else if (pending_signals)				\
-      process_pending_signals ();			\
-  } while (0)
-
+    process_pending_signals ();
 #else  /* not SYNC_INPUT */
+#define ELSE_PENDING_SIGNALS
+#endif	/* not SYNC_INPUT */
 
 #define QUIT						\
   do {							\
@@ -1960,10 +1950,9 @@
 	  Fthrow (Vthrow_on_input, Qt);			\
 	Fsignal (Qquit, Qnil);				\
       }							\
+    ELSE_PENDING_SIGNALS				\
   } while (0)
 
-#endif	/* not SYNC_INPUT */
-
 
 /* Nonzero if ought to quit now.  */