From 5396468298b0122469e0b41da8f49860d99a2b51 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Nov 2011 01:18:31 -0800 Subject: Spelling fixes. --- src/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 5d1784ad0b0..a4c85683061 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10137,7 +10137,7 @@ will read just one key sequence. */) ! NILP (can_return_switch_frame), 0); #if 0 /* The following is fine for code reading a key sequence and - then proceeding with a lenghty computation, but it's not good + then proceeding with a lengthy computation, but it's not good for code reading keys in a loop, like an input method. */ #ifdef HAVE_WINDOW_SYSTEM if (display_hourglass_p) -- cgit v1.2.1 From e1dbe924b53c541fdf238a5a722b7177d5c8760b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Nov 2011 18:29:42 -0800 Subject: Spelling fixes. --- src/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index a4c85683061..80873fcb57a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -12100,7 +12100,7 @@ This variable is keyboard-local. */); Function key definitions that apply to all terminal devices should go here. If a mapping is defined in both the current `local-function-key-map' binding and this variable, then the local -definition will take precendence. */); +definition will take precedence. */); Vfunction_key_map = Fmake_sparse_keymap (Qnil); DEFVAR_LISP ("key-translation-map", Vkey_translation_map, -- cgit v1.2.1 From fe7a3057a38e896a9c4ad12c831fb84a5d808691 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 20 Nov 2011 20:35:27 +0100 Subject: Fix typos. --- src/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 80873fcb57a..9b4ba427c24 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4813,7 +4813,7 @@ const char *const lispy_function_keys[] = "ico-00", /* VK_ICO_00 0xE4 */ 0, /* VK_PROCESSKEY 0xE5 - used by IME */ "ico-clear", /* VK_ICO_CLEAR 0xE6 */ - 0, /* VK_PACKET 0xE7 - used to pass unicode chars */ + 0, /* VK_PACKET 0xE7 - used to pass Unicode chars */ 0, /* 0xE8 */ "reset", /* VK_OEM_RESET 0xE9 */ "jump", /* VK_OEM_JUMP 0xEA */ -- cgit v1.2.1 From dbf312256d8a8c731dadaf27c1260832a3796350 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 28 Nov 2011 00:20:58 -0800 Subject: Remove GCPRO-related macros that exist only to avoid shadowing locals. * lisp.h (GCPRO1_VAR, GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR) (GCPRO6_VAR, UNGCPRO_VAR): Remove. See . All uses changed to use GCPRO1 etc. (GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6, UNGCPRO): Revert to old implementation (i.e., before 2011-03-11). --- src/keyboard.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 9b4ba427c24..e74c7ca1c68 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2998,7 +2998,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, { Lisp_Object keys; int key_count, key_count_reset; - struct gcpro inner_gcpro1; + struct gcpro gcpro1; int count = SPECPDL_INDEX (); /* Save the echo status. */ @@ -3026,7 +3026,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, keys = Fcopy_sequence (this_command_keys); else keys = Qnil; - GCPRO1_VAR (keys, inner_gcpro); + GCPRO1 (keys); /* Clear out this_command_keys. */ this_command_key_count = 0; @@ -3064,7 +3064,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, if (saved_immediate_echo) echo_now (); - UNGCPRO_VAR (inner_gcpro); + UNGCPRO; /* The input method can return no events. */ if (! CONSP (tem)) @@ -9053,9 +9053,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, int junk; #endif - struct gcpro outer_gcpro1; + struct gcpro gcpro1; - GCPRO1_VAR (fake_prefixed_keys, outer_gcpro); + GCPRO1 (fake_prefixed_keys); raw_keybuf_count = 0; last_nonmenu_event = Qnil; @@ -9351,7 +9351,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (EQ (key, Qt)) { unbind_to (count, Qnil); - UNGCPRO_VAR (outer_gcpro); + UNGCPRO; return -1; } @@ -10049,7 +10049,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, add_command_key (keybuf[t]); } - UNGCPRO_VAR (outer_gcpro); + UNGCPRO; return t; } -- cgit v1.2.1 From 3360a3fcb0c01428a42f1fb8a0b7459e0e6cac72 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 1 Dec 2011 19:27:52 +0100 Subject: Fixes: debbugs:10169 * src/keyboard.c (interrupt_signal): Don't call kill-emacs when waiting for input. --- src/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index e74c7ca1c68..8f316c5e446 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10858,7 +10858,7 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */ /* If there are no frames there, let's pretend that we are a well-behaving UN*X program and quit. We cannot do that while GC is in progress, though. */ - if (!gc_in_progress) + if (!gc_in_progress && !waiting_for_input) Fkill_emacs (Qnil); else Vquit_flag = Qt; -- cgit v1.2.1 From c80e3b4aed2e70eb6d8445d786c0df770094e9e1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 4 Dec 2011 00:02:42 -0800 Subject: Spelling fixes. --- src/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 8f316c5e446..7da0348cb25 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -12245,7 +12245,7 @@ text in the region before modifying the buffer. The next DEFVAR_LISP ("debug-on-event", Vdebug_on_event, doc: /* Enter debugger on this event. When Emacs -receives the special event specifed by this variable, it will try to +receives the special event specified by this variable, it will try to break into the debugger as soon as possible instead of processing the event normally through `special-event-map'. -- cgit v1.2.1 From 6c07aac2835c5ec4462fedb267f1bba5bb3cadc5 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 4 Dec 2011 10:26:30 +0100 Subject: Don't call Lisp in signal handler * emacs.c (Qkill_emacs): Define. (syms_of_emacs): Initialize it. * keyboard.c (interrupt_signal): Don't call Fkill_emacs here, set Qquit_flag to `kill-emacs' instead. (quit_throw_to_read_char): Add parameter `from_signal'. All callers changed. Call Fkill_emacs if requested and safe. * lisp.h (QUIT): Call Fkill_emacs if requested. --- src/keyboard.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 7da0348cb25..a114e495cf7 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -464,7 +464,7 @@ static void input_available_signal (int signo); static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); static void handle_interrupt (void); -static void quit_throw_to_read_char (void) NO_RETURN; +static void quit_throw_to_read_char (int) NO_RETURN; static void timer_start_idle (void); static void timer_stop_idle (void); static void timer_resume_idle (void); @@ -653,7 +653,7 @@ echo_now (void) echo_kboard = current_kboard; if (waiting_for_input && !NILP (Vquit_flag)) - quit_throw_to_read_char (); + quit_throw_to_read_char (0); } /* Turn off echoing, for the start of a new command. */ @@ -3817,7 +3817,7 @@ kbd_buffer_get_event (KBOARD **kbp, /* If the quit flag is set, then read_char will return quit_char, so that counts as "available input." */ if (!NILP (Vquit_flag)) - quit_throw_to_read_char (); + quit_throw_to_read_char (0); /* One way or another, wait until input is available; then, if interrupt handlers have not read it, read it now. */ @@ -10824,7 +10824,7 @@ set_waiting_for_input (struct timeval *time_to_clear) /* If handle_interrupt was called before and buffered a C-g, make it run again now, to avoid timing error. */ if (!NILP (Vquit_flag)) - quit_throw_to_read_char (); + quit_throw_to_read_char (0); } void @@ -10839,7 +10839,7 @@ clear_waiting_for_input (void) If we have a frame on the controlling tty, we assume that the SIGINT was generated by C-g, so we call handle_interrupt. - Otherwise, the handler kills Emacs. */ + Otherwise, tell QUIT to kill Emacs. */ static void interrupt_signal (int signalnum) /* If we don't have an argument, some */ @@ -10856,12 +10856,10 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */ if (!terminal) { /* If there are no frames there, let's pretend that we are a - well-behaving UN*X program and quit. We cannot do that while - GC is in progress, though. */ - if (!gc_in_progress && !waiting_for_input) - Fkill_emacs (Qnil); - else - Vquit_flag = Qt; + well-behaving UN*X program and quit. We must not call Lisp + in a signal handler, so tell QUIT to exit when it is + safe. */ + Vquit_flag = Qkill_emacs; } else { @@ -11010,15 +11008,20 @@ handle_interrupt (void) separate event loop thread like W32. */ #ifndef HAVE_NS if (waiting_for_input && !echoing) - quit_throw_to_read_char (); + quit_throw_to_read_char (1); #endif } /* Handle a C-g by making read_char return C-g. */ static void -quit_throw_to_read_char (void) +quit_throw_to_read_char (int from_signal) { + /* When not called from a signal handler it is safe to call + Lisp. */ + if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) + Fkill_emacs (Qnil); + sigfree (); /* Prevent another signal from doing this before we finish. */ clear_waiting_for_input (); -- cgit v1.2.1 From 3a6ad4f050f93ee8b609da50cb9e7ab8c934a9d6 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 5 Dec 2011 23:21:48 +0800 Subject: Handle X selection requests in input-pending-p. * src/keyboard.c (process_special_events): New function. (swallow_events, Finput_pending_p): Use it. Fixes: debbugs:10195 --- src/keyboard.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index a114e495cf7..2df1ba742ba 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -465,6 +465,7 @@ static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); static void handle_interrupt (void); static void quit_throw_to_read_char (int) NO_RETURN; +static void process_special_events (void); static void timer_start_idle (void); static void timer_stop_idle (void); static void timer_resume_idle (void); @@ -4145,14 +4146,12 @@ kbd_buffer_get_event (KBOARD **kbp, return (obj); } -/* Process any events that are not user-visible, - then return, without reading any user-visible events. */ +/* Process any non-user-visible events (currently X selection events), + without reading any user-visible events. */ -void -swallow_events (int do_display) +static void +process_special_events (void) { - int old_timers_run; - while (kbd_fetch_ptr != kbd_store_ptr) { struct input_event *event; @@ -4187,6 +4186,17 @@ swallow_events (int do_display) else break; } +} + +/* Process any events that are not user-visible, run timer events that + are ripe, and return, without reading any user-visible events. */ + +void +swallow_events (int do_display) +{ + int old_timers_run; + + process_special_events (); old_timers_run = timers_run; get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); @@ -10522,6 +10532,9 @@ if there is a doubt, the value is t. */) || !NILP (Vunread_input_method_events)) return (Qt); + /* Process non-user-visible events (Bug#10195). */ + process_special_events (); + get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW | READABLE_EVENTS_FILTER_EVENTS); -- cgit v1.2.1