From d1f55f1668a70cc196509d11c7c92d22b1aa5ee7 Mon Sep 17 00:00:00 2001
From: Chong Yidong <cyd@gnu.org>
Date: Mon, 12 Mar 2012 14:34:32 +0800
Subject: [PATCH] Rename inhibit_window_configuration_change_hook to
 inhibit_lisp_code. This is a tweak to 2012-02-23T07:28:21Z!cyd@gnu.org,
 suggested by Stefan.

* eval.c (inhibit_lisp_code): Rename from
inhibit_window_configuration_change_hook; move from window.c.

* xfns.c (unwind_create_frame_1, Fx_create_frame):
* window.c (run_window_configuration_change_hook)
(syms_of_window): Callers changed.
---
 src/ChangeLog | 9 +++++++++
 src/eval.c    | 8 ++++++++
 src/lisp.h    | 1 +
 src/window.c  | 7 +------
 src/window.h  | 4 ----
 src/xfns.c    | 7 +++----
 6 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 0bcbf4e269a..07cc8dac1b3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2012-03-12  Chong Yidong  <cyd@gnu.org>
+
+	* eval.c (inhibit_lisp_code): Rename from
+	inhibit_window_configuration_change_hook; move from window.c.
+
+	* xfns.c (unwind_create_frame_1, Fx_create_frame):
+	* window.c (run_window_configuration_change_hook)
+	(syms_of_window): Callers changed.
+
 2012-03-11  Chong Yidong  <cyd@gnu.org>
 
 	* keymap.c (Fkey_description): Doc fix (Bug#9700).
diff --git a/src/eval.c b/src/eval.c
index 344228741cb..4a3f5083b3b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -124,6 +124,12 @@ Lisp_Object Vsignaling_function;
 
 int handling_signal;
 
+/* If non-nil, Lisp code must not be run since some part of Emacs is
+   in an inconsistent state.  Currently, x-create-frame uses this to
+   avoid triggering window-configuration-change-hook while the new
+   frame is half-initialized.  */
+Lisp_Object inhibit_lisp_code;
+
 static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
 static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
 static int interactive_p (int);
@@ -3766,6 +3772,8 @@ alist of active lexical bindings.  */);
   staticpro (&Vsignaling_function);
   Vsignaling_function = Qnil;
 
+  inhibit_lisp_code = Qnil;
+
   defsubr (&Sor);
   defsubr (&Sand);
   defsubr (&Sif);
diff --git a/src/lisp.h b/src/lisp.h
index 36f58d05b42..bd19da55b2a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2937,6 +2937,7 @@ extern Lisp_Object Qinhibit_quit, Qclosure;
 extern Lisp_Object Qand_rest;
 extern Lisp_Object Vautoload_queue;
 extern Lisp_Object Vsignaling_function;
+extern Lisp_Object inhibit_lisp_code;
 extern int handling_signal;
 #if BYTE_MARK_STACK
 extern struct catchtag *catchlist;
diff --git a/src/window.c b/src/window.c
index be40e53f6b9..bcbf0ad2bde 100644
--- a/src/window.c
+++ b/src/window.c
@@ -122,9 +122,6 @@ static int window_initialized;
 /* Hook to run when window config changes.  */
 static Lisp_Object Qwindow_configuration_change_hook;
 
-/* If non-nil, run_window_configuration_change_hook does nothing.  */
-Lisp_Object inhibit_window_configuration_change_hook;
-
 /* Used by the function window_scroll_pixel_based */
 static int window_scroll_pixel_based_preserve_x;
 static int window_scroll_pixel_based_preserve_y;
@@ -2897,7 +2894,7 @@ run_window_configuration_change_hook (struct frame *f)
     = Fdefault_value (Qwindow_configuration_change_hook);
   XSETFRAME (frame, f);
 
-  if (NILP (Vrun_hooks) || !NILP (inhibit_window_configuration_change_hook))
+  if (NILP (Vrun_hooks) || !NILP (inhibit_lisp_code))
     return;
 
   /* Use the right buffer.  Matters when running the local hooks.  */
@@ -6527,8 +6524,6 @@ syms_of_window (void)
   window_scroll_preserve_hpos = -1;
   window_scroll_preserve_vpos = -1;
 
-  inhibit_window_configuration_change_hook = Qnil;
-
   DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function,
 	       doc: /* Non-nil means call as function to display a help buffer.
 The function is called with one argument, the buffer to be displayed.
diff --git a/src/window.h b/src/window.h
index f4a5f52b9a5..ea127ca95a8 100644
--- a/src/window.h
+++ b/src/window.h
@@ -810,10 +810,6 @@ extern Lisp_Object Vmouse_window;
 
 extern Lisp_Object Vmouse_event;
 
-/* If non-nil, run_window_configuration_change_hook does nothing.  */
-
-extern Lisp_Object inhibit_window_configuration_change_hook;
-
 EXFUN (Fnext_window, 3);
 EXFUN (Fselect_window, 2);
 EXFUN (Fset_window_buffer, 3);
diff --git a/src/xfns.c b/src/xfns.c
index 6fcd129e4a4..6f08ada1bb9 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2952,7 +2952,7 @@ unwind_create_frame (Lisp_Object frame)
 static Lisp_Object
 unwind_create_frame_1 (Lisp_Object val)
 {
-  inhibit_window_configuration_change_hook = val;
+  inhibit_lisp_code = val;
   return Qnil;
 }
 
@@ -3337,9 +3337,8 @@ This function is an internal primitive--use `make-frame' instead.  */)
      Vframe_list.  */
   {
     int count2 = SPECPDL_INDEX ();
-    record_unwind_protect (unwind_create_frame_1,
-			   inhibit_window_configuration_change_hook);
-    inhibit_window_configuration_change_hook = Qt;
+    record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code);
+    inhibit_lisp_code = Qt;
 
     x_default_parameter (f, parms, Qmenu_bar_lines,
 			 NILP (Vmenu_bar_mode)