[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Face initialization
From: |
Chong Yidong |
Subject: |
Re: Face initialization |
Date: |
Sun, 06 Jul 2008 23:06:41 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> The X resource settings are already stored in the `theme-face' property
>> of the default face, so face-spec-recalc applies it (now that it is
>> called for the default face).
>
> Oh, I didn't know about that. Do you happen to know the place in the
> source code where that `theme-face' is set? [I'm trying to track down
> a problem where X resources take too much precedence and maybe this
> will help me figure it out]
My mistake again :-P The entry in theme-face isn't used for new frames.
Its purpose is to record the face settings (derived from X resources
etc) prior to what is set by customization, so that it can be restored
when the customization is removed.
If I'm not mistaken, the X resources for new frames are applied during
x-create-frame itself. It calls x_default_parameter, which consults X
resource settings. Playing around with the face code indicates that the
X resources are indeed already applied when the frame is created, before
face-set-after-frame-default is called.
So I think the following simplified procedure for
x-create-frame-with-faces should DTRT (with the exception of the font
parameter, which I'm not sure how to handle):
(defun face-set-after-frame-default (frame parameters)
(dolist (face (face-list))
(condition-case ()
(progn
;; Initialize faces from face spec and custom theme.
(face-spec-recalc face frame)
;; Apply attributes specified by face-new-frame-defaults
(internal-merge-in-global-face face frame))
;; Don't let invalid specs prevent frame creation.
(error nil)))
;; Apply attributes specified by frame parameters explicitly
;; passed to `make-frame' or in `default-frame-alist'.
(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))))
(dolist (param face-params)
(let* ((param-name (nth 0 param))
(value (cdr (or (assq param-name parameters)
(assq param-name default-frame-alist)))))
(if value
(set-face-attribute (nth 1 param) frame
(nth 2 param) value))))))
- Face initialization, Chong Yidong, 2008/07/06
- Re: Face initialization, Stefan Monnier, 2008/07/06
- Re: Face initialization, Chong Yidong, 2008/07/06
- Re: Face initialization, Stefan Monnier, 2008/07/06
- Re: Face initialization,
Chong Yidong <=
- Re: Face initialization, Stefan Monnier, 2008/07/07
- Re: Face initialization, Richard M Stallman, 2008/07/07
- Re: Face initialization, Stephen J. Turnbull, 2008/07/07
- Re: Face initialization, Richard M Stallman, 2008/07/08
- Re: Face initialization, Jason Rumney, 2008/07/08
- Re: Face initialization, Richard M Stallman, 2008/07/08
- Re: Face initialization, Richard M Stallman, 2008/07/07
- Re: Face initialization, Chong Yidong, 2008/07/07
- Re: Face initialization, Jason Rumney, 2008/07/09
- Re: Face initialization, Chong Yidong, 2008/07/09