From: Chong Yidong Date: Thu, 1 Jul 2010 00:14:17 +0000 (-0400) Subject: Fix application of default-frame-alist (Bug#5378). X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~51^2~84 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c1ef4455eaa816d8953d0c7cbef498cc727d4d34;p=emacs.git 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d07acce079a..0184aa2dd94 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2010-06-30 Chong Yidong + + * 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 * startup.el (command-line): Don't call tool-bar-setup in a diff --git a/lisp/faces.el b/lisp/faces.el index 900e96ed048..61476e3cd5f 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1948,8 +1948,7 @@ according to the `background-mode' and `display-type' frame parameters." "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 @@ Value is the new parameter list." (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 @@ Value is the new parameter list." "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 @@ Value is the new parameter list." (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 @@ Value is the new frame created." 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 @@ frame parameters in PARAMETERS and `default-frame-alist'." (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 @@ frame parameters in PARAMETERS and `default-frame-alist'." (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 diff --git a/lisp/frame.el b/lisp/frame.el index de33715aed4..10abed1ff19 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -683,15 +683,17 @@ The functions are run with one arg, the newly created frame.") (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 @@ You cannot specify either `width' or `height', you must use neither or both. (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 @@ setup is for focus to follow the pointer." (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) diff --git a/src/ChangeLog b/src/ChangeLog index dac377ebbfe..2667ef41ad0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-06-30 Chong Yidong + + * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't + check default-frame-alist. + 2010-06-30 Andreas Schwab * process.c (create_process): Avoid using invalid file descriptors. diff --git a/src/frame.c b/src/frame.c index f542595e5f5..c323c61be69 100644 --- a/src/frame.c +++ b/src/frame.c @@ -627,8 +627,7 @@ make_terminal_frame (struct terminal *terminal) /* 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 @@ get_future_frame_param (Lisp_Object parameter, 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 @@ affects all frames on the same terminal device. */) 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)),