aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorStefan Monnier2020-12-12 09:56:04 -0500
committerStefan Monnier2020-12-12 09:56:04 -0500
commitadbb4eacc2a984c0fc0b65ec761368fd9067d6c5 (patch)
treef2496954a664e3c02f01a76b4f22ec1a479fd3d9 /src/process.c
parent7ee0fc0dc1a7cba8a3e965f411aca498a7db3f4f (diff)
downloademacs-adbb4eacc2a984c0fc0b65ec761368fd9067d6c5.tar.gz
emacs-adbb4eacc2a984c0fc0b65ec761368fd9067d6c5.zip
* src/keyboard.c: Fix bug#5803.
A long time ago, `read_key_sequence` used to read the keymaps at the start, so if something happened between this start and the moment the user actually hits a key, `read_key_sequence` could end up using the wrong keymaps. To work around this problem, the code used `record_asynch_buffer_change` to try and trigger `read_key_sequence` to re-read the keymaps in some known cases. Several years ago, `read_key_sequence` was changed so as to read the keymaps only once the user hits a key, making this machinery now redundant (and also harmful apparently in bug#5803 because it introduces "spurious" events). So we here remove `record_asynch_buffer_change` and the `BUFFER_SWITCH_EVENT` and `Qbuffer_switch` pseudo-events it generated. * src/termhooks.h (enum event_kind): Delete `BUFFER_SWITCH_EVENT`. * src/keyboard.c: (record_asynch_buffer_change): Delete function. (syms_of_keyboard): Delete `Qbuffer_switch`. (force_auto_save_soon, readable_events) (kbd_buffer_store_buffered_event, kbd_buffer_get_event) (make_lispy_event): * src/xterm.c (handle_one_xevent): * src/w32term.c (w32_read_socket): * src/process.c (wait_reading_process_output) (read_and_dispose_of_process_output, exec_sentinel): Simplify accordingly.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/process.c b/src/process.c
index bf64ead24e5..48b727d9e3b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5333,14 +5333,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5333 5333
5334 timer_delay = timer_check (); 5334 timer_delay = timer_check ();
5335 5335
5336 /* If a timer has run, this might have changed buffers
5337 an alike. Make read_key_sequence aware of that. */
5338 if (timers_run != old_timers_run
5339 && (old_buffer != current_buffer
5340 || !EQ (old_window, selected_window))
5341 && waiting_for_user_input_p == -1)
5342 record_asynch_buffer_change ();
5343
5344 if (timers_run != old_timers_run && do_display) 5336 if (timers_run != old_timers_run && do_display)
5345 /* We must retry, since a timer may have requeued itself 5337 /* We must retry, since a timer may have requeued itself
5346 and that could alter the time_delay. */ 5338 and that could alter the time_delay. */
@@ -5706,14 +5698,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5706 leave = true; 5698 leave = true;
5707 } 5699 }
5708 5700
5709 /* If a timer has run, this might have changed buffers
5710 an alike. Make read_key_sequence aware of that. */
5711 if (timers_run != old_timers_run
5712 && waiting_for_user_input_p == -1
5713 && (old_buffer != current_buffer
5714 || !EQ (old_window, selected_window)))
5715 record_asynch_buffer_change ();
5716
5717 if (leave) 5701 if (leave)
5718 break; 5702 break;
5719 } 5703 }
@@ -6213,18 +6197,6 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars,
6213 /* Restore waiting_for_user_input_p as it was 6197 /* Restore waiting_for_user_input_p as it was
6214 when we were called, in case the filter clobbered it. */ 6198 when we were called, in case the filter clobbered it. */
6215 waiting_for_user_input_p = waiting; 6199 waiting_for_user_input_p = waiting;
6216
6217#if 0 /* Call record_asynch_buffer_change unconditionally,
6218 because we might have changed minor modes or other things
6219 that affect key bindings. */
6220 if (! EQ (Fcurrent_buffer (), obuffer)
6221 || ! EQ (current_buffer->keymap, okeymap))
6222#endif
6223 /* But do it only if the caller is actually going to read events.
6224 Otherwise there's no need to make him wake up, and it could
6225 cause trouble (for example it would make sit_for return). */
6226 if (waiting_for_user_input_p == -1)
6227 record_asynch_buffer_change ();
6228} 6200}
6229 6201
6230DEFUN ("internal-default-process-filter", Finternal_default_process_filter, 6202DEFUN ("internal-default-process-filter", Finternal_default_process_filter,
@@ -7390,16 +7362,6 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
7390 when we were called, in case the filter clobbered it. */ 7362 when we were called, in case the filter clobbered it. */
7391 waiting_for_user_input_p = waiting; 7363 waiting_for_user_input_p = waiting;
7392 7364
7393#if 0
7394 if (! EQ (Fcurrent_buffer (), obuffer)
7395 || ! EQ (current_buffer->keymap, okeymap))
7396#endif
7397 /* But do it only if the caller is actually going to read events.
7398 Otherwise there's no need to make him wake up, and it could
7399 cause trouble (for example it would make sit_for return). */
7400 if (waiting_for_user_input_p == -1)
7401 record_asynch_buffer_change ();
7402
7403 unbind_to (count, Qnil); 7365 unbind_to (count, Qnil);
7404} 7366}
7405 7367