[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#203005: emacs21: Emacs21 does not honor customized default

From: Eli Zaretskii
Subject: Re: Bug#203005: emacs21: Emacs21 does not honor customized default
Date: 11 Dec 2003 19:01:15 +0200

> Date: Thu, 11 Dec 2003 12:37:53 +0000
> From: Matt Kern <address@hidden>
> +2002-05-31  Eli Zaretskii  <address@hidden>
> +
> +     * faces.el (face-set-after-frame-default): Don't change `default' face.
> I am not sure why this change has been made.  Presumably the default
> face is supposed to be inherited or set elsewhere?
> Can you shed some light on it, Eli?

You are asking me to remember the reason for a 1-line change 18
months after I've made that change.  It's not easy, but I'll try.

This change appears in CVS HEAD on a different date (2001-12-30) and
was made there by Richard Stallman (CC'ed).  So I'm guessing that at
a later date Richard asked me to make the same change on the 21.3
release branch, which I did.  Perhaps Richard remembers the reason
for the original change.

Anyway, the CVS HEAD code includes an additional fragment in
face-set-after-frame-default, which the 21.3 version doesn't seem to
have.  I attached face-set-after-frame-default from CVS at the end of
this message; note the first part of it which deals specifically with
setting up the `default' face.

So I'd suggest to insert that initial code fragment into 21.3's
version of the function and see if that solves the problem.  I don't
remember the details, but my vague recollection is that we skipped the
default face for some good reason.


(defun face-set-after-frame-default (frame)
  "Set frame-local faces of FRAME from face specs and resources.
Initialize colors of certain faces from frame parameters."
  (if (face-attribute 'default :font t)
      (set-face-attribute 'default frame :font
                          (face-attribute 'default :font t))
    (set-face-attribute 'default frame :family
                        (face-attribute 'default :family t))
    (set-face-attribute 'default frame :height
                        (face-attribute 'default :height t))
    (set-face-attribute 'default frame :slant
                        (face-attribute 'default :slant t))
    (set-face-attribute 'default frame :weight
                        (face-attribute 'default :weight t))
    (set-face-attribute 'default frame :width
                        (face-attribute 'default :width t)))
  (dolist (face (face-list))
    ;; Don't let frame creation fail because of an invalid face spec.
    (condition-case ()
        (when (not (equal face 'default))
          (face-spec-set face (face-user-default-spec face) frame)
          (internal-merge-in-global-face face frame)
          (when (and (memq window-system '(x w32 mac))
                     (or (not (boundp 'inhibit-default-face-x-resources))
                         (not (eq face 'default))))
            (make-face-x-resource-internal face frame)))
      (error nil)))
  ;; Initialize attributes from frame parameters.
  (let ((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 params)
      (let ((frame-param (frame-parameter frame (nth 0 param)))
            (face (nth 1 param))
            (attr (nth 2 param)))
        (when (and frame-param
                   ;; Don't override face attributes explicitly
                   ;; specified for new frames.
                   (eq (face-attribute face attr t) 'unspecified))
          (set-face-attribute face frame attr frame-param))))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]