I am confused.
My fault. I've moved on to a different bug in mid-conversation. I'll try to
stay focused. :-)
I thought the original problem was that face-spec-set
called face-display-set which modified the default face although the
display spec was ((mswindows ...)) and thus init-face-from-resources
dis nothing? face-display-set uses face-spec-match-display which
compares the device type against the display spec and should thus
fail. You wrote that was not what happening...
That's not what is happening, the call to x-init-global-faces isn't guarded by
face-spec-match-display; it's happening anytime face-spec-set is called on
'default face, whether any changes are made to 'default or not!
Would something like the following make sense? It seems to fix the problem for
me...
diff -u faces.el.orig faces.el
--- faces.el.orig Wed Feb 17 10:10:10 1999
+++ faces.el Wed Feb 17 10:30:45 1999
@@ -1207,17 +1207,15 @@
(reset-face face frame)
(face-display-set face spec frame)
(init-face-from-resources face frame))
- (let ((frames (relevant-custom-frames)))
- (reset-face face)
- (if (and (eq 'default face) (featurep 'x))
- (x-init-global-faces))
- (face-display-set face spec)
+ (let ((frames (relevant-custom-frames))
+ (reinitialized-p (list nil)))
+ (face-display-set face spec reinitialized-p)
(while frames
- (face-display-set face spec (car frames))
+ (face-display-set face spec reinitialized-p (car frames))
(pop frames))
(init-face-from-resources face))))
-(defun face-display-set (face spec &optional frame)
+(defun face-display-set (face spec reinitialized-p &optional frame)
"Set FACE to the attributes to the first matching entry in SPEC.
Iff optional FRAME is non-nil, set it for that frame only.
See `defface' for information about SPEC."
@@ -1226,6 +1224,11 @@
(atts (cadar spec)))
(pop spec)
(when (face-spec-set-match-display display frame)
+ (unless (car reinitialized-p)
+ (reset-face face)
+ (if (and (eq 'default face) (featurep 'x))
+ (x-init-global-faces))
+ (setcar reinitialized-p t))
;; Avoid creating frame local duplicates of the global face.
(unless (and frame (eq display (get face 'custom-face-display)))
(apply 'face-custom-attributes-set face frame atts))
diff -u cus-face.el.orig cus-face.el
--- cus-face.el.orig Wed Feb 17 10:29:27 1999
+++ cus-face.el Wed Feb 17 10:30:22 1999
@@ -36,15 +36,16 @@
;; If the user has already created the face, respect that.
(let ((value (or (get face 'saved-face) spec))
(frames (relevant-custom-frames))
+ (reinitialized-p (list nil))
frame)
;; Create global face.
(make-empty-face face)
- (face-display-set face value)
+ (face-display-set face value reinitialized-p)
;; Create frame local faces
(while frames
(setq frame (car frames)
frames (cdr frames))
- (face-display-set face value frame))
+ (face-display-set face value reinitialized-p frame))
(init-face-from-resources face)))
(when (and doc (null (face-doc-string face)))
(set-face-doc-string face doc))
Anyway you seem to have enough info and a test case you can probably
use edebug and find out exactly where this is going wrong.
Jan