changeset 76435:f602ddf5430e

(help_form_saved_window_configs): New var. (read_char_help_form_unwind): New function. (read_char): Don't restore window configuration if a mouse click arrives while the help form is being displayed.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 10 Mar 2007 04:57:18 +0000
parents c746fe9f5d0e
children abf6e5660200
files src/keyboard.c
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sat Mar 10 04:56:41 2007 +0000
+++ b/src/keyboard.c	Sat Mar 10 04:57:18 2007 +0000
@@ -2450,6 +2450,17 @@
 static Lisp_Object kbd_buffer_get_event ();
 static void record_char ();
 
+static Lisp_Object help_form_saved_window_configs;
+static Lisp_Object
+read_char_help_form_unwind (arg)
+{
+  Lisp_Object window_config = XCAR (help_form_saved_window_configs);
+  help_form_saved_window_configs = XCDR (help_form_saved_window_configs);
+  if (!NILP (window_config))
+    Fset_window_configuration (window_config);
+  return Qnil;
+}
+
 #ifdef MULTI_KBOARD
 static jmp_buf wrong_kboard_jmpbuf;
 #endif
@@ -3319,8 +3330,10 @@
       Lisp_Object tem0;
       count = SPECPDL_INDEX ();
 
-      record_unwind_protect (Fset_window_configuration,
-			     Fcurrent_window_configuration (Qnil));
+      help_form_saved_window_configs
+	= Fcons (Fcurrent_window_configuration (Qnil),
+		 help_form_saved_window_configs);
+      record_unwind_protect (read_char_help_form_unwind, Qnil);
 
       tem0 = Feval (Vhelp_form);
       if (STRINGP (tem0))
@@ -3328,7 +3341,12 @@
 
       cancel_echoing ();
       do
-	c = read_char (0, 0, 0, Qnil, 0, NULL);
+	{
+	  c = read_char (0, 0, 0, Qnil, 0, NULL);
+	  if (EVENT_HAS_PARAMETERS (c)
+	      && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_click))
+	    XSETCAR (help_form_saved_window_configs, Qnil);
+	}
       while (BUFFERP (c));
       /* Remove the help from the frame */
       unbind_to (count, Qnil);
@@ -11335,6 +11353,9 @@
   menu_bar_items_vector = Qnil;
   staticpro (&menu_bar_items_vector);
 
+  help_form_saved_window_configs = Qnil;
+  staticpro (&help_form_saved_window_configs);
+
   defsubr (&Scurrent_idle_time);
   defsubr (&Sevent_convert_list);
   defsubr (&Sread_key_sequence);