unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Faces applies to new frames
Date: Sat, 28 Jun 2008 23:14:11 -0400	[thread overview]
Message-ID: <jwviqvthsjy.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <871w2hcek1.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 28 Jun 2008 19:42:06 -0400")

>>> +     ;; 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))
>> 
>> But doesn't that mean that (make-frame '((font . "foo-bar"))) will
>> disregard the explicit request for "foo-bar"?

> True.  I think that in this case, x-create-frame-with-faces should take
> note that it is passed a `font' frame parameter, and tell
> face-set-after-frame-default to stick to that instead of imposing
> whatever the `default' face says.

And that's exactly the reason why I introduced `font-parameter'.
Basically, I think that frame parameters should generally take
precedence since they may really be set on a frame-by-frame basis.
We can try and distinguish parameters coming from default-frame-alist
from those coming from elsewhere (pop-up-frame-alist,
minibuffer-frame-alist, ...), but it seems a simpler solution is to not
try and distinguish between the provenance and simply blindly give
priority to frame parameters.

This implies that set-face-attribute should probably store global
settings elsewhere than on default-frame-alist.  It sounds like
face-new-frame-defaults would be a good place for that instead (th0o
this is only based on its name)

Here's my current understanding of the various places where we store
face info:

- face-new-frame-defaults, should be global and seems to only ever
  contain "unspecified".  I.e. pretty much unused.
- defface.  Can go from global to terminal-specific.
  Usually terminal-specific.
- Xresources.  Can go from terminal-specific to frame-specific.
  Usually terminal-specific.
- default-frame-alist and other frame parameters.  Can go from global to
  frame-specific.

Are there any more?
I've sorted them based on their locality, so if we follow the principle
that more-local should take precedence over more global settings, they
should be taken in this order.  And indeed, I believe it's the order in
which they're applied right now.

Based on the above, we then have to figure out how set-face-attribute
(when applied globally) should affect the above settings, depending on
the effect we're looking for.

Here's a suggestion:
1 - rule out frame-specific Xresources settings
2 - make face-new-frame-defaults terminal-local, so it's initialized at
    terminal-creation time by applying defface and Xresources settings.
3 - rule that "global" set-face-attribute settings only apply to future
    frames on the same terminals (i.e. they're not truly global any
    more), so it can work by modifying the terminal's
    face-new-frame-defaults and it will hence take precedence over
    customize (i.e. defface) and Xresources settings.

This will also have the advantage that the only face-initialization we
need to do at frame-creation time is to apply the few face-relevant
settings from the frame parameters.  I.e. It will speed up frame creation
significantly when you have many faces.


        Stefan




  reply	other threads:[~2008-06-29  3:14 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 22:50 Faces applies to new frames Chong Yidong
2008-06-26 23:08 ` Miles Bader
2008-06-27  1:28 ` Stefan Monnier
2008-06-27  2:43   ` Chong Yidong
2008-06-27  6:18     ` Stefan Monnier
2008-06-27 17:32       ` Chong Yidong
2008-06-27 17:52         ` Stefan Monnier
2008-06-27 17:54           ` Chong Yidong
2008-06-27 10:48   ` Robert J. Chassell
2008-06-27 12:17   ` Robert J. Chassell
2008-06-28 16:01   ` Chong Yidong
2008-06-28 20:17     ` Stefan Monnier
2008-06-28 23:42       ` Chong Yidong
2008-06-29  3:14         ` Stefan Monnier [this message]
2008-06-29  3:42           ` Miles Bader
2008-06-29  4:22             ` Stefan Monnier
2008-06-29  4:43               ` Miles Bader
2008-06-29  4:47                 ` Chong Yidong
2008-06-29  8:51                   ` David Kastrup
2008-06-29  5:36                 ` Stefan Monnier
2008-06-29 15:20                   ` Richard M Stallman
2008-06-29 17:08                     ` Chong Yidong
2008-06-30 14:43                       ` Richard M Stallman
2008-06-29 19:42                     ` Stefan Monnier
2008-06-30 14:43                       ` Richard M Stallman
2008-06-29  4:30           ` Chong Yidong
2008-06-29  6:11             ` Stefan Monnier
2008-06-29 15:25               ` Chong Yidong
2008-06-29 18:00                 ` Stefan Monnier
2008-06-29 19:24                   ` Chong Yidong
2008-06-29 20:00                     ` Stefan Monnier
2008-06-29 20:29                       ` Chong Yidong
2008-06-30  0:58                         ` Stefan Monnier
2008-06-30  2:24                           ` Chong Yidong
2008-06-30  4:46                             ` Stefan Monnier
2008-06-30  5:02                               ` Chong Yidong
2008-06-30 14:43                         ` Richard M Stallman
2008-06-29  2:48   ` Chong Yidong
2008-06-29  3:41     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwviqvthsjy.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).