changeset 88050:449ffc76e463

* window.c (run_window_configuration_change_hook): New function. Code extracted from set_window_buffer. Set the selected frame. (set_window_buffer): Use it. * window.h (run_window_configuration_change_hook): Declare. * dispnew.c (change_frame_size_1): Use it instead of set-window-buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 28 Jan 2008 19:05:13 +0000
parents 3f51de0dbaee
children a67ed67d274a
files src/ChangeLog src/dispnew.c src/window.c src/window.h
diffstat 4 files changed, 28 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Jan 28 18:49:55 2008 +0000
+++ b/src/ChangeLog	Mon Jan 28 19:05:13 2008 +0000
@@ -1,5 +1,11 @@
 2008-01-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* window.c (run_window_configuration_change_hook): New function.
+	Code extracted from set_window_buffer.  Set the selected frame.
+	(set_window_buffer): Use it.
+	* window.h (run_window_configuration_change_hook): Declare.
+	* dispnew.c (change_frame_size_1): Use it instead of set-window-buffer.
+
 	* keyboard.c (read_char): Yet another int/Lisp_Object mixup (YAILOM).
 
 2008-01-27  Dan Nicolaescu  <dann@ics.uci.edu>
--- a/src/dispnew.c	Mon Jan 28 18:49:55 2008 +0000
+++ b/src/dispnew.c	Mon Jan 28 19:05:13 2008 +0000
@@ -6386,9 +6386,7 @@
 
   record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
 
-  /* This isn't quite a no-op: it runs window-configuration-change-hook.  */
-  Fset_window_buffer (FRAME_SELECTED_WINDOW (f),
-		      XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer, Qt);
+  run_window_configuration_change_hook (f);
 
   unbind_to (count, Qnil);
 }
--- a/src/window.c	Mon Jan 28 18:49:55 2008 +0000
+++ b/src/window.c	Mon Jan 28 19:05:13 2008 +0000
@@ -3307,6 +3307,25 @@
 EXFUN (Fset_window_fringes, 4);
 EXFUN (Fset_window_scroll_bars, 4);
 
+void
+run_window_configuration_change_hook (struct frame *f)
+{
+  if (! NILP (Vwindow_configuration_change_hook)
+      && ! NILP (Vrun_hooks))
+    {
+      int count = SPECPDL_INDEX ();
+      if (SELECTED_FRAME () != f)
+	{
+	  Lisp_Object frame;
+	  XSETFRAME (frame, f);
+	  record_unwind_protect (Fselect_frame, Fselected_frame ());
+	  Fselect_frame (frame);
+	}
+      call1 (Vrun_hooks, Qwindow_configuration_change_hook);
+      unbind_to (count, Qnil);
+    }
+}
+
 /* Make WINDOW display BUFFER as its contents.  RUN_HOOKS_P non-zero
    means it's allowed to run hooks.  See make_frame for a case where
    it's not allowed.  KEEP_MARGINS_P non-zero means that the current
@@ -3408,10 +3427,7 @@
       if (! NILP (Vwindow_scroll_functions))
 	run_hook_with_args_2 (Qwindow_scroll_functions, window,
 			      Fmarker_position (w->start));
-
-      if (! NILP (Vwindow_configuration_change_hook)
-	  && ! NILP (Vrun_hooks))
-	call1 (Vrun_hooks, Qwindow_configuration_change_hook);
+      run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w)));
     }
 
   unbind_to (count, Qnil);
--- a/src/window.h	Mon Jan 28 18:49:55 2008 +0000
+++ b/src/window.h	Mon Jan 28 19:05:13 2008 +0000
@@ -790,6 +790,7 @@
 extern void grow_mini_window P_ ((struct window *, int));
 extern void shrink_mini_window P_ ((struct window *));
 
+void run_window_configuration_change_hook (struct frame *f);
 
 /* Make WINDOW display BUFFER as its contents.  RUN_HOOKS_P non-zero
    means it's allowed to run hooks.  See make_frame for a case where