changeset 109089:bd58a72bb9bb

Fix application of default-frame-alist (Bug#5378). * lisp/frame.el (make-frame): Add default-frame-alist to the PARAMETERS argument passed to frame-creation-function (Bug#5378). * lisp/faces.el (x-handle-named-frame-geometry) (x-handle-reverse-video, x-create-frame-with-faces) (face-set-after-frame-default, tty-create-frame-with-faces): Don't separately consult default-frame-alist. It is now passed as the PARAMETER argument. * src/frame.c (get_future_frame_param, Fmake_terminal_frame): Don't check default-frame-alist.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 30 Jun 2010 20:14:17 -0400
parents 05a72c8a402b
children 4de0b34e2c2e
files lisp/ChangeLog lisp/faces.el lisp/frame.el src/ChangeLog src/frame.c
diffstat 5 files changed, 54 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Jul 01 02:08:29 2010 +0200
+++ b/lisp/ChangeLog	Wed Jun 30 20:14:17 2010 -0400
@@ -1,3 +1,14 @@
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* frame.el (make-frame): Add default-frame-alist to the PARAMETERS
+	argument passed to frame-creation-function (Bug#5378).
+
+	* faces.el (x-handle-named-frame-geometry)
+	(x-handle-reverse-video, x-create-frame-with-faces)
+	(face-set-after-frame-default, tty-create-frame-with-faces): Don't
+	separately consult default-frame-alist.  It is now passed as the
+	PARAMETER argument.
+
 2010-06-30  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* startup.el (command-line): Don't call tool-bar-setup in a
--- a/lisp/faces.el	Thu Jul 01 02:08:29 2010 +0200
+++ b/lisp/faces.el	Wed Jun 30 20:14:17 2010 -0400
@@ -1948,8 +1948,7 @@
   "Add geometry parameters for a named frame to parameter list PARAMETERS.
 Value is the new parameter list."
   ;; Note that `x-resource-name' has a global meaning.
-  (let ((x-resource-name (or (cdr (assq 'name parameters))
-			     (cdr (assq 'name default-frame-alist)))))
+  (let ((x-resource-name (cdr (assq 'name parameters))))
     (when x-resource-name
       ;; Before checking X resources, we must have an X connection.
       (or (window-system)
@@ -1960,7 +1959,7 @@
 	(and (setq res-geometry (x-get-resource "geometry" "Geometry"))
 	     (setq parsed (x-parse-geometry res-geometry))
 	     (setq parameters
-		   (append parameters default-frame-alist parsed
+		   (append parameters parsed
 			   ;; If the resource specifies a position,
 			   ;; take note of that.
 			   (if (or (assq 'top parsed) (assq 'left parsed))
@@ -1972,7 +1971,6 @@
   "Handle the reverse-video frame parameter and X resource.
 `x-create-frame' does not handle this one."
   (when (cdr (or (assq 'reverse parameters)
-		 (assq 'reverse default-frame-alist)
 		 (let ((resource (x-get-resource "reverseVideo"
 						 "ReverseVideo")))
 		   (if resource
@@ -1998,13 +1996,10 @@
 (declare-function x-setup-function-keys "term/x-win" (frame))
 
 (defun x-create-frame-with-faces (&optional parameters)
-  "Create a frame from optional frame parameters PARAMETERS.
-Parameters not specified by PARAMETERS are taken from
-`default-frame-alist'.  If PARAMETERS specify a frame name,
-handle X geometry resources for that name.  If either PARAMETERS
-or `default-frame-alist' contains a `reverse' parameter, or
-the X resource ``reverseVideo'' is present, handle that.
-Value is the new frame created."
+  "Create and return a frame with frame parameters PARAMETERS.
+If PARAMETERS specify a frame name, handle X geometry resources
+for that name.  If PARAMETERS includes a `reverse' parameter, or
+the X resource ``reverseVideo'' is present, handle that."
   (setq parameters (x-handle-named-frame-geometry parameters))
   (let* ((params (copy-tree parameters))
 	 (visibility-spec (assq 'visibility parameters))
@@ -2035,7 +2030,7 @@
 Calculate the face definitions using the face specs, custom theme
 settings, X resources, and `face-new-frame-defaults'.
 Finally, apply any relevant face attributes found amongst the
-frame parameters in PARAMETERS and `default-frame-alist'."
+frame parameters in PARAMETERS."
   (dolist (face (nreverse (face-list))) ;Why reverse?  --Stef
     (condition-case ()
 	(progn
@@ -2061,16 +2056,14 @@
   		       (mouse-color mouse :background))))
     (dolist (param face-params)
       (let* ((param-name (nth 0 param))
-  	     (value (cdr (or (assq param-name parameters)
-  			     (assq param-name default-frame-alist)))))
+  	     (value (cdr (assq param-name parameters))))
   	(if value
   	    (set-face-attribute (nth 1 param) frame
 				(nth 2 param) value))))))
 
 (defun tty-handle-reverse-video (frame parameters)
   "Handle the reverse-video frame parameter for terminal frames."
-  (when (cdr (or (assq 'reverse parameters)
-		 (assq 'reverse default-frame-alist)))
+  (when (cdr (assq 'reverse parameters))
     (let* ((params (frame-parameters frame))
 	   (bg (cdr (assq 'foreground-color params)))
 	   (fg (cdr (assq 'background-color params))))
@@ -2086,11 +2079,8 @@
 
 
 (defun tty-create-frame-with-faces (&optional parameters)
-  "Create a frame from optional frame parameters PARAMETERS.
-Parameters not specified by PARAMETERS are taken from
-`default-frame-alist'.  If either PARAMETERS or `default-frame-alist'
-contains a `reverse' parameter, handle that.  Value is the new frame
-created."
+  "Create and return a frame from optional frame parameters PARAMETERS.
+If PARAMETERS contains a `reverse' parameter, handle that."
   (let ((frame (make-terminal-frame parameters))
 	success)
     (unwind-protect
--- a/lisp/frame.el	Thu Jul 01 02:08:29 2010 +0200
+++ b/lisp/frame.el	Wed Jun 30 20:14:17 2010 -0400
@@ -683,15 +683,17 @@
 
 (defun make-frame (&optional parameters)
   "Return a newly created frame displaying the current buffer.
-Optional argument PARAMETERS is an alist of parameters for the new frame.
-Each element of PARAMETERS should have the form (NAME . VALUE), for example:
+Optional argument PARAMETERS is an alist of frame parameters for
+the new frame.  Each element of PARAMETERS should have the
+form (NAME . VALUE), for example:
 
  (name . STRING)	The frame should be named STRING.
 
  (width . NUMBER)	The frame should be NUMBER characters in width.
  (height . NUMBER)	The frame should be NUMBER text lines high.
 
-You cannot specify either `width' or `height', you must use neither or both.
+You cannot specify either `width' or `height', you must specify
+neither or both.
 
  (minibuffer . t)	The frame should have a minibuffer.
  (minibuffer . nil)	The frame should have no minibuffer.
@@ -703,15 +705,17 @@
 
  (terminal . TERMINAL)  The frame should use the terminal object TERMINAL.
 
-Before the frame is created (via `frame-creation-function-alist'), functions on the
-hook `before-make-frame-hook' are run.  After the frame is created, functions
-on `after-make-frame-functions' are run with one arg, the newly created frame.
+In addition, any parameter specified in `default-frame-alist',
+but not present in PARAMETERS, is applied.
 
-This function itself does not make the new frame the selected frame.
-The previously selected frame remains selected.  However, the
-window system may select the new frame for its own reasons, for
-instance if the frame appears under the mouse pointer and your
-setup is for focus to follow the pointer."
+Before creating the frame (via `frame-creation-function-alist'),
+this function runs the hook `before-make-frame-hook'.  After
+creating the frame, it runs the hook `after-make-frame-functions'
+with one arg, the newly created frame.
+
+On graphical displays, this function does not itself make the new
+frame the selected frame.  However, the window system may select
+the new frame according to its own rules."
   (interactive)
   (let* ((w (cond
 	     ((assq 'terminal parameters)
@@ -726,14 +730,21 @@
 	     (t window-system)))
 	 (frame-creation-function (cdr (assq w frame-creation-function-alist)))
 	 (oldframe (selected-frame))
+	 (params parameters)
 	 frame)
     (unless frame-creation-function
       (error "Don't know how to create a frame on window system %s" w))
+    ;; Add parameters from `window-system-default-frame-alist'.
+    (dolist (p (cdr (assq w window-system-default-frame-alist)))
+      (unless (memq (car p) params)
+	(push p params)))
+    ;; Add parameters from `default-frame-alist'.
+    (dolist (p default-frame-alist)
+      (unless (memq (car p) params)
+	(push p params)))
+    ;; Now make the frame.
     (run-hooks 'before-make-frame-hook)
-    (setq frame
-          (funcall frame-creation-function
-                   (append parameters
-                           (cdr (assq w window-system-default-frame-alist)))))
+    (setq frame (funcall frame-creation-function params))
     (normal-erase-is-backspace-setup-frame frame)
     ;; Inherit the original frame's parameters.
     (dolist (param frame-inherited-parameters)
--- a/src/ChangeLog	Thu Jul 01 02:08:29 2010 +0200
+++ b/src/ChangeLog	Wed Jun 30 20:14:17 2010 -0400
@@ -1,3 +1,8 @@
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* frame.c (get_future_frame_param, Fmake_terminal_frame): Don't
+	check default-frame-alist.
+
 2010-06-30  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* process.c (create_process): Avoid using invalid file descriptors.
--- a/src/frame.c	Thu Jul 01 02:08:29 2010 +0200
+++ b/src/frame.c	Wed Jun 30 20:14:17 2010 -0400
@@ -627,8 +627,7 @@
 
 /* Get a suitable value for frame parameter PARAMETER for a newly
    created frame, based on (1) the user-supplied frame parameter
-   alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
-   fails, (3) Vdefault_frame_alist.  */
+   alist SUPPLIED_PARMS, and (2) CURRENT_VALUE.  */
 
 static Lisp_Object
 get_future_frame_param (Lisp_Object parameter,
@@ -642,8 +641,6 @@
     result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
   if (NILP (result) && current_value != NULL)
     result = build_string (current_value);
-  if (NILP (result))
-    result = Fassq (parameter, Vdefault_frame_alist);
   if (!NILP (result) && !STRINGP (result))
     result = XCDR (result);
   if (NILP (result) || !STRINGP (result))
@@ -748,7 +745,6 @@
   adjust_glyphs (f);
   calculate_costs (f);
   XSETFRAME (frame, f);
-  Fmodify_frame_parameters (frame, Vdefault_frame_alist);
   Fmodify_frame_parameters (frame, parms);
   Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
                                                  build_string (t->display_info.tty->type)),