changeset 83445:1b1b0cb2e2a8

Experimental change: don't restore kboard after temporary changes if Emacs wasn't in single kboard state. * src/keyboard.c (pop_kboard): Help debugging by not changing current_kboard unnecessarily. (temporarily_switch_to_single_kboard, record_single_kboard_state): Don't push_kboard if we weren't in single kboard state. Don't pop_kboard if we popped into any kboard state. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-485
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 02 Jan 2006 07:54:50 +0000
parents 00c55c52afd8
children 8eba1344ed4f
files src/keyboard.c
diffstat 1 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Mon Jan 02 07:50:53 2006 +0000
+++ b/src/keyboard.c	Mon Jan 02 07:54:50 2006 +0000
@@ -1139,16 +1139,17 @@
 #ifdef MULTI_KBOARD
   struct terminal *t;
   struct kboard_stack *p = kboard_stack;
-  current_kboard = NULL;
+  int found = 0;
   for (t = terminal_list; t; t = t->next_terminal)
     {
       if (t->kboard == p->kboard)
         {
           current_kboard = p->kboard;
+          found = 1;
           break;
         }
     }
-  if (current_kboard == NULL)
+  if (!found)
     {
       /* The terminal we remembered has been deleted.  */
       current_kboard = FRAME_KBOARD (SELECTED_FRAME ());
@@ -1168,10 +1169,15 @@
 {
 #ifdef MULTI_KBOARD
   int was_locked = single_kboard;
-  if (k != NULL)
-    push_kboard (k);
-  else
-    push_kboard (current_kboard);
+  if (was_locked)
+    {
+      if (k != NULL)
+        push_kboard (k);
+      else
+        push_kboard (current_kboard);
+    }
+  else if (k != NULL)
+    current_kboard = k;
   single_kboard_state ();
   record_unwind_protect (restore_kboard_configuration,
                          (was_locked ? Qt : Qnil));
@@ -1181,7 +1187,8 @@
 void
 record_single_kboard_state ()
 {
-  push_kboard (current_kboard);
+  if (single_kboard)
+    push_kboard (current_kboard);
   record_unwind_protect (restore_kboard_configuration,
                          (single_kboard ? Qt : Qnil));
 }
@@ -1193,8 +1200,10 @@
   if (NILP (was_locked))
     any_kboard_state ();
   else
-    single_kboard_state ();
-  pop_kboard ();
+    {
+      single_kboard_state ();
+      pop_kboard ();
+    }
   return Qnil;
 }