[Top][All Lists]

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

Re: 23.0.50; face-problems with multy-tty

From: Johan Bockgård
Subject: Re: 23.0.50; face-problems with multy-tty
Date: Thu, 13 Sep 2007 18:05:04 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     > face-spec-set is supposed to operate on all frames
>     > when the FRAME argument is nil.  If it doesn't,
>     > then either its code or its documentation needs to be changed.
>     It does "operate on all frames". The problem is that it sets the same
>     attributes everywhere.
> Is that a bug in face-spec-set?  It sounds like one.

I can't answer that question.

> If it is, the thing to do is fix it, not work around it.
> Would you like to look for the right fix?

The old code boiled down to calling `set-face-attribute' with a null
FRAME argument. This sets a new frame default that is the same for all
frames (via face-new-frame-defaults). That is not what we want.

The new code calls set-face-attribute locally for each frame. It does
not set a default in face-new-frame-defaults. This DTRT unless a default
exists in face-new-frame-defaults (or an X resource exists for the

What is needed is something like what `C-M-x' does on `defface' forms.
It removes the global default (in face-new-frame-defaults) before
setting the specs. But it doesn't do the right thing if a face has been
set via X resources (cf. Re: can't set both mode-line color and default
frame font?).

(E.g the X resource setting "Emacs.foo.attributeForeground: blue" can't
be overridden by <C-M-x> on

    (defface foo
      '((t :foreground "red"))

I think it comes down to this code in face-set-after-frame-default

    ;; Initialize faces from face specs and X resources.  The
    ;; condition-case prevents invalid specs from causing frame
    ;; creation to fail.
    (dolist (face (delq 'default (face-list)))
      (condition-case ()
            (face-spec-set face (face-user-default-spec face) frame) ; (1)
            (if (memq (window-system frame) '(x w32 mac))
                (make-face-x-resource-internal face frame))          ; (2)
            (internal-merge-in-global-face face frame))              ; (3)
        (error nil)))

We want `custom-set-faces' to use frame local specs (1).

This requires clearing the global definition (3) (in
face-new-frame-defaults, using face-spec-reset-face)

But we also need to override the X resource definition for new frames
(2), without using the same global definition everywhere (which is what
(3) does). What would be a good way to do that?

Johan Bockgård

reply via email to

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