[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Faces applies to new frames
From: |
Chong Yidong |
Subject: |
Re: Faces applies to new frames |
Date: |
Sat, 28 Jun 2008 12:01:36 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
> by default there is no `font' parameter in default-frame-alist, so as
> long as we leave it that way, it should not affect face settings. The
> code in face-set-after-frame-default should apply the defface-spec to
> every new frame, so we shouldn't need any entry in default-frame-alist
> for it to apply to new frames.
There are several problems here, so let's take it one at a time. First,
let's ignore Customize and try to make set-face-attribute work properly.
In this case, default faces aren't properly set for future frames. The
problem lies in the interaction between face attributes and the `font'
frame parameter. For historical reasons, we allow the attributes of the
default face to be changed by this frame parameter. But that means that
when we create a new frame, the initial value of this frame parameter
needs to be set based on the value of the `default' face. Otherwise, it
will override whatever attributes the `default' face has that were set
by set-face-attribute.
The attached patch does this. It also removes the `font-parameter'
frame parameter, which is used to override the default face (a similar
patch will be needed for w32fns.c). I think this is bogus.
*** trunk/lisp/faces.el.~1.416.~ 2008-06-28 11:45:58.000000000 -0400
--- trunk/lisp/faces.el 2008-06-28 11:48:47.000000000 -0400
***************
*** 2017,2029 ****
;; Find attributes that should be initialized from frame parameters.
(let ((face-params '((foreground-color default :foreground)
(background-color default :background)
- (font-parameter default :font)
(border-color border :background)
(cursor-color cursor :background)
(scroll-bar-foreground scroll-bar :foreground)
(scroll-bar-background scroll-bar :background)
(mouse-color mouse :background)))
! apply-params)
(dolist (param face-params)
(let* ((value (frame-parameter frame (nth 0 param)))
(face (nth 1 param))
--- 2017,2028 ----
;; Find attributes that should be initialized from frame parameters.
(let ((face-params '((foreground-color default :foreground)
(background-color default :background)
(border-color border :background)
(cursor-color cursor :background)
(scroll-bar-foreground scroll-bar :foreground)
(scroll-bar-background scroll-bar :background)
(mouse-color mouse :background)))
! apply-params default-font)
(dolist (param face-params)
(let* ((value (frame-parameter frame (nth 0 param)))
(face (nth 1 param))
***************
*** 2056,2061 ****
--- 2055,2065 ----
(make-face-x-resource-internal face frame))
(internal-merge-in-global-face face frame))
(error nil)))
+ ;; The face specs may specify a different default font. Save this
+ ;; in the `font' frame parameter.
+ (setq default-font (face-font 'default))
+ (when default-font
+ (set-frame-parameter frame 'font default-font))
;; Apply the attributes specified by frame parameters. This
;; rewrites parameters changed by make-face-x-resource-internal
(dolist (param apply-params)
*** trunk/src/xfns.c.~1.720.~ 2008-06-27 18:18:48.000000000 -0400
--- trunk/src/xfns.c 2008-06-28 11:50:55.000000000 -0400
***************
*** 204,210 ****
Lisp_Object Qsuppress_icon;
Lisp_Object Qundefined_color;
Lisp_Object Qcompound_text, Qcancel_timer;
- static Lisp_Object Qfont_param;
/* In dispnew.c */
--- 204,209 ----
***************
*** 3098,3109 ****
if (NILP (font))
error ("No suitable font was found");
}
- else if (!NILP (font_param))
- {
- /* Remember the explicit font parameter, so we can re-apply it after
- we've applied the `default' face settings. */
- x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param),
Qnil));
- }
x_default_parameter (f, parms, Qfont, font, "font", "Font",
RES_TYPE_STRING);
}
--- 3097,3102 ----
***************
*** 5871,5878 ****
staticpro (&Qcompound_text);
Qcancel_timer = intern ("cancel-timer");
staticpro (&Qcancel_timer);
- Qfont_param = intern ("font-parameter");
- staticpro (&Qfont_param);
/* This is the end of symbol initialization. */
/* Text property `display' should be nonsticky by default. */
--- 5864,5869 ----
Re: Faces applies to new frames, Robert J. Chassell, 2008/06/27
Re: Faces applies to new frames, Robert J. Chassell, 2008/06/27
Re: Faces applies to new frames,
Chong Yidong <=
- Re: Faces applies to new frames, Stefan Monnier, 2008/06/28
- Re: Faces applies to new frames, Chong Yidong, 2008/06/28
- Re: Faces applies to new frames, Stefan Monnier, 2008/06/28
- Re: Faces applies to new frames, Miles Bader, 2008/06/28
- Re: Faces applies to new frames, Stefan Monnier, 2008/06/29
- Re: Faces applies to new frames, Miles Bader, 2008/06/29
- Re: Faces applies to new frames, Chong Yidong, 2008/06/29
- Re: Faces applies to new frames, David Kastrup, 2008/06/29
Re: Faces applies to new frames, Stefan Monnier, 2008/06/29
Re: Faces applies to new frames, Richard M Stallman, 2008/06/29