Mercurial > emacs
changeset 47643:e6806bc4402e
(STOP_POLLING, RESUME_POLLING): New macros.
(read_char): Use them. Do all exits thru the end of the function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 27 Sep 2002 17:03:46 +0000 |
parents | 0fc00c55911a |
children | de6f2422c09f |
files | src/keyboard.c |
diffstat | 1 files changed, 17 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/keyboard.c Fri Sep 27 04:55:22 2002 +0000 +++ b/src/keyboard.c Fri Sep 27 17:03:46 2002 +0000 @@ -2144,6 +2144,14 @@ 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. @@ -2183,6 +2191,7 @@ volatile int reread; struct gcpro gcpro1, gcpro2; EMACS_TIME last_idle_start; + int polling_stopped_here = 0; also_record = Qnil; @@ -2284,7 +2293,7 @@ || executing_macro_index >= XFASTINT (Flength (Vexecuting_macro))) { XSETINT (c, -1); - RETURN_UNGCPRO (c); + goto exit; } c = Faref (Vexecuting_macro, make_number (executing_macro_index)); @@ -2516,7 +2525,7 @@ /* 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. */ @@ -2623,7 +2632,7 @@ 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 @@ -2692,7 +2701,7 @@ 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)) { @@ -2709,7 +2718,7 @@ 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. */ @@ -2744,7 +2753,7 @@ { /* 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) && SCHARS (Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) @@ -2986,6 +2995,8 @@ } } + exit: + RESUME_POLLING; RETURN_UNGCPRO (c); }