static jmp_buf wrong_kboard_jmpbuf;
#endif
+#define STOP_POLLING \
+do { if (! polling_stopped_here) stop_polling (); \
+ polling_stopped_here = 1; } while (0)
+
+#define RESUME_POLLING \
+do { if (polling_stopped_here) start_polling (); \
+ polling_stopped_here = 0; } while (0)
+
/* read a character from the keyboard; call the redisplay if needed */
/* commandflag 0 means do not do auto-saving, but do do redisplay.
-1 means do not do redisplay, but do do autosaving.
volatile int reread;
struct gcpro gcpro1, gcpro2;
EMACS_TIME last_idle_start;
+ int polling_stopped_here = 0;
also_record = Qnil;
|| executing_macro_index >= XFASTINT (Flength (Vexecuting_macro)))
{
XSETINT (c, -1);
- RETURN_UNGCPRO (c);
+ goto exit;
}
c = Faref (Vexecuting_macro, make_number (executing_macro_index));
/* Now that we have read an event, Emacs is not idle. */
timer_stop_idle ();
- RETURN_UNGCPRO (c);
+ goto exit;
}
/* Maybe autosave and/or garbage collect due to idleness. */
wrong_kboard:
- stop_polling ();
+ STOP_POLLING;
/* Finally, we read from the main queue,
and if that gives us something we can't use yet, we put it on the
should the next event read be a help-echo. */
last_idle_start = timer_idleness_start_time;
timer_stop_idle ();
- start_polling ();
+ RESUME_POLLING;
if (NILP (c))
{
so don't show them to the user.
Also, don't record a key if we already did. */
if (BUFFERP (c) || key_already_recorded)
- RETURN_UNGCPRO (c);
+ goto exit;
/* Process special events within read_char
and loop around to read another event. */
{
/* If kbd_buffer_get_event gave us an EOF, return that. */
if (XINT (c) == -1)
- RETURN_UNGCPRO (c);
+ goto exit;
if ((STRINGP (Vkeyboard_translate_table)
&& XSTRING (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c))
}
}
+ exit:
+ RESUME_POLLING;
RETURN_UNGCPRO (c);
}