aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index ab7cb34a030..6fa38aa1328 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -195,14 +195,15 @@ Lisp_Object unread_switch_frame;
195/* Last size recorded for a current buffer which is not a minibuffer. */ 195/* Last size recorded for a current buffer which is not a minibuffer. */
196static ptrdiff_t last_non_minibuf_size; 196static ptrdiff_t last_non_minibuf_size;
197 197
198/* Total number of times read_char has returned, modulo UINTMAX_MAX + 1. */
199uintmax_t num_input_events; 198uintmax_t num_input_events;
199ptrdiff_t point_before_last_command_or_undo;
200struct buffer *buffer_before_last_command_or_undo;
200 201
201/* Value of num_nonmacro_input_events as of last auto save. */ 202/* Value of num_nonmacro_input_events as of last auto save. */
202 203
203static EMACS_INT last_auto_save; 204static EMACS_INT last_auto_save;
204 205
205/* The value of point when the last command was started. */ 206/* The value of point when the last command was started. */
206static ptrdiff_t last_point_position; 207static ptrdiff_t last_point_position;
207 208
208/* The frame in which the last input event occurred, or Qmacro if the 209/* The frame in which the last input event occurred, or Qmacro if the
@@ -1449,6 +1450,11 @@ command_loop_1 (void)
1449 result of changes from the last command. */ 1450 result of changes from the last command. */
1450 call0 (Qundo_auto__add_boundary); 1451 call0 (Qundo_auto__add_boundary);
1451 1452
1453 /* Record point and buffer, so we can put point into the undo
1454 information if necessary. */
1455 point_before_last_command_or_undo = PT;
1456 buffer_before_last_command_or_undo = current_buffer;
1457
1452 call1 (Qcommand_execute, Vthis_command); 1458 call1 (Qcommand_execute, Vthis_command);
1453 1459
1454#ifdef HAVE_WINDOW_SYSTEM 1460#ifdef HAVE_WINDOW_SYSTEM
@@ -3313,14 +3319,12 @@ readable_events (int flags)
3313#endif 3319#endif
3314 )) 3320 ))
3315 { 3321 {
3316 union buffered_input_event *event; 3322 union buffered_input_event *event = kbd_fetch_ptr;
3317
3318 event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE)
3319 ? kbd_fetch_ptr
3320 : kbd_buffer);
3321 3323
3322 do 3324 do
3323 { 3325 {
3326 if (event == kbd_buffer + KBD_BUFFER_SIZE)
3327 event = kbd_buffer;
3324 if (!( 3328 if (!(
3325#ifdef USE_TOOLKIT_SCROLL_BARS 3329#ifdef USE_TOOLKIT_SCROLL_BARS
3326 (flags & READABLE_EVENTS_FILTER_EVENTS) && 3330 (flags & READABLE_EVENTS_FILTER_EVENTS) &&
@@ -3337,8 +3341,6 @@ readable_events (int flags)
3337 && event->kind == BUFFER_SWITCH_EVENT)) 3341 && event->kind == BUFFER_SWITCH_EVENT))
3338 return 1; 3342 return 1;
3339 event++; 3343 event++;
3340 if (event == kbd_buffer + KBD_BUFFER_SIZE)
3341 event = kbd_buffer;
3342 } 3344 }
3343 while (event != kbd_store_ptr); 3345 while (event != kbd_store_ptr);
3344 } 3346 }
@@ -11372,7 +11374,7 @@ If an unhandled error happens in running this hook,
11372the function in which the error occurred is unconditionally removed, since 11374the function in which the error occurred is unconditionally removed, since
11373otherwise the error might happen repeatedly and make Emacs nonfunctional. 11375otherwise the error might happen repeatedly and make Emacs nonfunctional.
11374 11376
11375See also `pre-command-hook'. */); 11377See also `post-command-hook'. */);
11376 Vpre_command_hook = Qnil; 11378 Vpre_command_hook = Qnil;
11377 11379
11378 DEFVAR_LISP ("post-command-hook", Vpost_command_hook, 11380 DEFVAR_LISP ("post-command-hook", Vpost_command_hook,