changeset 100075:9b936c1c7102

(timer_check): After a timer runs, ensure that the selected window's buffer is current.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 30 Nov 2008 17:33:36 +0000
parents 621a2ff9faff
children 8b3ca7176f5e
files src/keyboard.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sun Nov 30 17:33:22 2008 +0000
+++ b/src/keyboard.c	Sun Nov 30 17:33:36 2008 +0000
@@ -4584,12 +4584,8 @@
 	    {
 	      int count = SPECPDL_INDEX ();
 	      Lisp_Object old_deactivate_mark = Vdeactivate_mark;
-
-#if 0 /* This shouldn't be necessary anymore.  --lorentey  */
-	      /* On unbind_to, resume allowing input from any kboard, if that
-                 was true before.  */
-              record_single_kboard_state ();
-#endif
+	      struct buffer *b;
+
 	      /* Mark the timer as triggered to prevent problems if the lisp
 		 code fails to reschedule it right.  */
 	      vector[0] = Qt;
@@ -4601,6 +4597,13 @@
 	      timers_run++;
 	      unbind_to (count, Qnil);
 
+	      /* We must ensure that the current buffer is the same as
+		 the selected window's buffer, because the timers may
+		 have made another buffer current (bug#1458).  */
+	      b = XBUFFER (XWINDOW (selected_window)->buffer);
+	      if (b != current_buffer)
+		set_buffer_internal (b);
+	      
 	      /* Since we have handled the event,
 		 we don't need to tell the caller to wake up and do it.  */
 	    }