aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-06-30 20:14:17 -0400
committerChong Yidong2010-06-30 20:14:17 -0400
commitc1ef4455eaa816d8953d0c7cbef498cc727d4d34 (patch)
treefa15a55fab0d37e79e3dd5ef3af86272c5251eed
parentacd0102aa4f62f36b260f81ce3373dc95c9cbef5 (diff)
downloademacs-c1ef4455eaa816d8953d0c7cbef498cc727d4d34.tar.gz
emacs-c1ef4455eaa816d8953d0c7cbef498cc727d4d34.zip
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.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/faces.el32
-rw-r--r--lisp/frame.el41
-rw-r--r--src/ChangeLog5
-rw-r--r--src/frame.c6
5 files changed, 54 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d07acce079a..0184aa2dd94 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12010-06-30 Chong Yidong <cyd@stupidchicken.com>
2
3 * frame.el (make-frame): Add default-frame-alist to the PARAMETERS
4 argument passed to frame-creation-function (Bug#5378).
5
6 * faces.el (x-handle-named-frame-geometry)
7 (x-handle-reverse-video, x-create-frame-with-faces)
8 (face-set-after-frame-default, tty-create-frame-with-faces): Don't
9 separately consult default-frame-alist. It is now passed as the
10 PARAMETER argument.
11
12010-06-30 Andreas Schwab <schwab@linux-m68k.org> 122010-06-30 Andreas Schwab <schwab@linux-m68k.org>
2 13
3 * startup.el (command-line): Don't call tool-bar-setup in a 14 * 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."
1948 "Add geometry parameters for a named frame to parameter list PARAMETERS. 1948 "Add geometry parameters for a named frame to parameter list PARAMETERS.
1949Value is the new parameter list." 1949Value is the new parameter list."
1950 ;; Note that `x-resource-name' has a global meaning. 1950 ;; Note that `x-resource-name' has a global meaning.
1951 (let ((x-resource-name (or (cdr (assq 'name parameters)) 1951 (let ((x-resource-name (cdr (assq 'name parameters))))
1952 (cdr (assq 'name default-frame-alist)))))
1953 (when x-resource-name 1952 (when x-resource-name
1954 ;; Before checking X resources, we must have an X connection. 1953 ;; Before checking X resources, we must have an X connection.
1955 (or (window-system) 1954 (or (window-system)
@@ -1960,7 +1959,7 @@ Value is the new parameter list."
1960 (and (setq res-geometry (x-get-resource "geometry" "Geometry")) 1959 (and (setq res-geometry (x-get-resource "geometry" "Geometry"))
1961 (setq parsed (x-parse-geometry res-geometry)) 1960 (setq parsed (x-parse-geometry res-geometry))
1962 (setq parameters 1961 (setq parameters
1963 (append parameters default-frame-alist parsed 1962 (append parameters parsed
1964 ;; If the resource specifies a position, 1963 ;; If the resource specifies a position,
1965 ;; take note of that. 1964 ;; take note of that.
1966 (if (or (assq 'top parsed) (assq 'left parsed)) 1965 (if (or (assq 'top parsed) (assq 'left parsed))
@@ -1972,7 +1971,6 @@ Value is the new parameter list."
1972 "Handle the reverse-video frame parameter and X resource. 1971 "Handle the reverse-video frame parameter and X resource.
1973`x-create-frame' does not handle this one." 1972`x-create-frame' does not handle this one."
1974 (when (cdr (or (assq 'reverse parameters) 1973 (when (cdr (or (assq 'reverse parameters)
1975 (assq 'reverse default-frame-alist)
1976 (let ((resource (x-get-resource "reverseVideo" 1974 (let ((resource (x-get-resource "reverseVideo"
1977 "ReverseVideo"))) 1975 "ReverseVideo")))
1978 (if resource 1976 (if resource
@@ -1998,13 +1996,10 @@ Value is the new parameter list."
1998(declare-function x-setup-function-keys "term/x-win" (frame)) 1996(declare-function x-setup-function-keys "term/x-win" (frame))
1999 1997
2000(defun x-create-frame-with-faces (&optional parameters) 1998(defun x-create-frame-with-faces (&optional parameters)
2001 "Create a frame from optional frame parameters PARAMETERS. 1999 "Create and return a frame with frame parameters PARAMETERS.
2002Parameters not specified by PARAMETERS are taken from 2000If PARAMETERS specify a frame name, handle X geometry resources
2003`default-frame-alist'. If PARAMETERS specify a frame name, 2001for that name. If PARAMETERS includes a `reverse' parameter, or
2004handle X geometry resources for that name. If either PARAMETERS 2002the X resource ``reverseVideo'' is present, handle that."
2005or `default-frame-alist' contains a `reverse' parameter, or
2006the X resource ``reverseVideo'' is present, handle that.
2007Value is the new frame created."
2008 (setq parameters (x-handle-named-frame-geometry parameters)) 2003 (setq parameters (x-handle-named-frame-geometry parameters))
2009 (let* ((params (copy-tree parameters)) 2004 (let* ((params (copy-tree parameters))
2010 (visibility-spec (assq 'visibility parameters)) 2005 (visibility-spec (assq 'visibility parameters))
@@ -2035,7 +2030,7 @@ Value is the new frame created."
2035Calculate the face definitions using the face specs, custom theme 2030Calculate the face definitions using the face specs, custom theme
2036settings, X resources, and `face-new-frame-defaults'. 2031settings, X resources, and `face-new-frame-defaults'.
2037Finally, apply any relevant face attributes found amongst the 2032Finally, apply any relevant face attributes found amongst the
2038frame parameters in PARAMETERS and `default-frame-alist'." 2033frame parameters in PARAMETERS."
2039 (dolist (face (nreverse (face-list))) ;Why reverse? --Stef 2034 (dolist (face (nreverse (face-list))) ;Why reverse? --Stef
2040 (condition-case () 2035 (condition-case ()
2041 (progn 2036 (progn
@@ -2061,16 +2056,14 @@ frame parameters in PARAMETERS and `default-frame-alist'."
2061 (mouse-color mouse :background)))) 2056 (mouse-color mouse :background))))
2062 (dolist (param face-params) 2057 (dolist (param face-params)
2063 (let* ((param-name (nth 0 param)) 2058 (let* ((param-name (nth 0 param))
2064 (value (cdr (or (assq param-name parameters) 2059 (value (cdr (assq param-name parameters))))
2065 (assq param-name default-frame-alist)))))
2066 (if value 2060 (if value
2067 (set-face-attribute (nth 1 param) frame 2061 (set-face-attribute (nth 1 param) frame
2068 (nth 2 param) value)))))) 2062 (nth 2 param) value))))))
2069 2063
2070(defun tty-handle-reverse-video (frame parameters) 2064(defun tty-handle-reverse-video (frame parameters)
2071 "Handle the reverse-video frame parameter for terminal frames." 2065 "Handle the reverse-video frame parameter for terminal frames."
2072 (when (cdr (or (assq 'reverse parameters) 2066 (when (cdr (assq 'reverse parameters))
2073 (assq 'reverse default-frame-alist)))
2074 (let* ((params (frame-parameters frame)) 2067 (let* ((params (frame-parameters frame))
2075 (bg (cdr (assq 'foreground-color params))) 2068 (bg (cdr (assq 'foreground-color params)))
2076 (fg (cdr (assq 'background-color params)))) 2069 (fg (cdr (assq 'background-color params))))
@@ -2086,11 +2079,8 @@ frame parameters in PARAMETERS and `default-frame-alist'."
2086 2079
2087 2080
2088(defun tty-create-frame-with-faces (&optional parameters) 2081(defun tty-create-frame-with-faces (&optional parameters)
2089 "Create a frame from optional frame parameters PARAMETERS. 2082 "Create and return a frame from optional frame parameters PARAMETERS.
2090Parameters not specified by PARAMETERS are taken from 2083If PARAMETERS contains a `reverse' parameter, handle that."
2091`default-frame-alist'. If either PARAMETERS or `default-frame-alist'
2092contains a `reverse' parameter, handle that. Value is the new frame
2093created."
2094 (let ((frame (make-terminal-frame parameters)) 2084 (let ((frame (make-terminal-frame parameters))
2095 success) 2085 success)
2096 (unwind-protect 2086 (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.")
683 683
684(defun make-frame (&optional parameters) 684(defun make-frame (&optional parameters)
685 "Return a newly created frame displaying the current buffer. 685 "Return a newly created frame displaying the current buffer.
686Optional argument PARAMETERS is an alist of parameters for the new frame. 686Optional argument PARAMETERS is an alist of frame parameters for
687Each element of PARAMETERS should have the form (NAME . VALUE), for example: 687the new frame. Each element of PARAMETERS should have the
688form (NAME . VALUE), for example:
688 689
689 (name . STRING) The frame should be named STRING. 690 (name . STRING) The frame should be named STRING.
690 691
691 (width . NUMBER) The frame should be NUMBER characters in width. 692 (width . NUMBER) The frame should be NUMBER characters in width.
692 (height . NUMBER) The frame should be NUMBER text lines high. 693 (height . NUMBER) The frame should be NUMBER text lines high.
693 694
694You cannot specify either `width' or `height', you must use neither or both. 695You cannot specify either `width' or `height', you must specify
696neither or both.
695 697
696 (minibuffer . t) The frame should have a minibuffer. 698 (minibuffer . t) The frame should have a minibuffer.
697 (minibuffer . nil) The frame should have no minibuffer. 699 (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.
703 705
704 (terminal . TERMINAL) The frame should use the terminal object TERMINAL. 706 (terminal . TERMINAL) The frame should use the terminal object TERMINAL.
705 707
706Before the frame is created (via `frame-creation-function-alist'), functions on the 708In addition, any parameter specified in `default-frame-alist',
707hook `before-make-frame-hook' are run. After the frame is created, functions 709but not present in PARAMETERS, is applied.
708on `after-make-frame-functions' are run with one arg, the newly created frame.
709 710
710This function itself does not make the new frame the selected frame. 711Before creating the frame (via `frame-creation-function-alist'),
711The previously selected frame remains selected. However, the 712this function runs the hook `before-make-frame-hook'. After
712window system may select the new frame for its own reasons, for 713creating the frame, it runs the hook `after-make-frame-functions'
713instance if the frame appears under the mouse pointer and your 714with one arg, the newly created frame.
714setup is for focus to follow the pointer." 715
716On graphical displays, this function does not itself make the new
717frame the selected frame. However, the window system may select
718the new frame according to its own rules."
715 (interactive) 719 (interactive)
716 (let* ((w (cond 720 (let* ((w (cond
717 ((assq 'terminal parameters) 721 ((assq 'terminal parameters)
@@ -726,14 +730,21 @@ setup is for focus to follow the pointer."
726 (t window-system))) 730 (t window-system)))
727 (frame-creation-function (cdr (assq w frame-creation-function-alist))) 731 (frame-creation-function (cdr (assq w frame-creation-function-alist)))
728 (oldframe (selected-frame)) 732 (oldframe (selected-frame))
733 (params parameters)
729 frame) 734 frame)
730 (unless frame-creation-function 735 (unless frame-creation-function
731 (error "Don't know how to create a frame on window system %s" w)) 736 (error "Don't know how to create a frame on window system %s" w))
737 ;; Add parameters from `window-system-default-frame-alist'.
738 (dolist (p (cdr (assq w window-system-default-frame-alist)))
739 (unless (memq (car p) params)
740 (push p params)))
741 ;; Add parameters from `default-frame-alist'.
742 (dolist (p default-frame-alist)
743 (unless (memq (car p) params)
744 (push p params)))
745 ;; Now make the frame.
732 (run-hooks 'before-make-frame-hook) 746 (run-hooks 'before-make-frame-hook)
733 (setq frame 747 (setq frame (funcall frame-creation-function params))
734 (funcall frame-creation-function
735 (append parameters
736 (cdr (assq w window-system-default-frame-alist)))))
737 (normal-erase-is-backspace-setup-frame frame) 748 (normal-erase-is-backspace-setup-frame frame)
738 ;; Inherit the original frame's parameters. 749 ;; Inherit the original frame's parameters.
739 (dolist (param frame-inherited-parameters) 750 (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 @@
12010-06-30 Chong Yidong <cyd@stupidchicken.com>
2
3 * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't
4 check default-frame-alist.
5
12010-06-30 Andreas Schwab <schwab@linux-m68k.org> 62010-06-30 Andreas Schwab <schwab@linux-m68k.org>
2 7
3 * process.c (create_process): Avoid using invalid file descriptors. 8 * 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)
627 627
628/* Get a suitable value for frame parameter PARAMETER for a newly 628/* Get a suitable value for frame parameter PARAMETER for a newly
629 created frame, based on (1) the user-supplied frame parameter 629 created frame, based on (1) the user-supplied frame parameter
630 alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else 630 alist SUPPLIED_PARMS, and (2) CURRENT_VALUE. */
631 fails, (3) Vdefault_frame_alist. */
632 631
633static Lisp_Object 632static Lisp_Object
634get_future_frame_param (Lisp_Object parameter, 633get_future_frame_param (Lisp_Object parameter,
@@ -642,8 +641,6 @@ get_future_frame_param (Lisp_Object parameter,
642 result = Fassq (parameter, XFRAME (selected_frame)->param_alist); 641 result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
643 if (NILP (result) && current_value != NULL) 642 if (NILP (result) && current_value != NULL)
644 result = build_string (current_value); 643 result = build_string (current_value);
645 if (NILP (result))
646 result = Fassq (parameter, Vdefault_frame_alist);
647 if (!NILP (result) && !STRINGP (result)) 644 if (!NILP (result) && !STRINGP (result))
648 result = XCDR (result); 645 result = XCDR (result);
649 if (NILP (result) || !STRINGP (result)) 646 if (NILP (result) || !STRINGP (result))
@@ -748,7 +745,6 @@ affects all frames on the same terminal device. */)
748 adjust_glyphs (f); 745 adjust_glyphs (f);
749 calculate_costs (f); 746 calculate_costs (f);
750 XSETFRAME (frame, f); 747 XSETFRAME (frame, f);
751 Fmodify_frame_parameters (frame, Vdefault_frame_alist);
752 Fmodify_frame_parameters (frame, parms); 748 Fmodify_frame_parameters (frame, parms);
753 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type, 749 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
754 build_string (t->display_info.tty->type)), 750 build_string (t->display_info.tty->type)),