unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Faces applies to new frames
Date: Fri, 27 Jun 2008 13:32:39 -0400	[thread overview]
Message-ID: <877icardfs.fsf@stupidchicken.com> (raw)
In-Reply-To: <jwvtzffjtfq.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 27 Jun 2008 02:18:04 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Maybe there's more than one bug here.  When set-face-attribute is called
>> with a nil FRAME argument, that changes the face for all frames, and
>> this is done via frame parameters and not by changing the defface spec.
>> I don't think face-set-after-frame-default is even relevant to this
>> case.
>
> Indeed, there's also the distinction between face changes made via
> customize and those made by direct calls to set-face-attribute.
>
> The more I look at it, the mor it seems obvious that we cannot fix it
> by looking at individual events, but we need to first figure out it
> currently (fails to) work overall, and then design a way to make it
> work in an overall consistent way.

This is how information is currently saved for future frames.  In
addition to the defface spec, which stores information in the Lisp
symbol of the face name, there are two relevant variables:
default-frame-alist, which stores frame parameters for future frames,
and face-new-frame-defaults, which stores the default face definitions.

Finternal_set_lisp_face_attribute (called by set-face-attribute) is
supposed to do two things: changes the face on existing frames, and (if
passed an integer FRAME argument) change the defaults for future frames.

Currently, the latter is accomplished for only certain attributes: the
(default) foreground and background color, the default font, and the
colors for the border, cursor, scroll-bar, and mouse.  These are saved
by modifying default-frame-alist.  It does NOT modify
face-new-frame-defaults.

When a new frame is created, the faces are initialized using
face-set-after-frame-default.  This does a few things:

 1. Set the default face based on face-new-frame-defaults, via
    face-attribute with a t FRAME argument.  (It only does this if
    inhibit-face-set-after-frame-default is nil, which may be bogus,
    since that variable is only bound when doing set-face-attribute,
    which does not create frames.)

 2. Walk through (face-list), applying defface specs to the rest of the
    faces for this frame.

 3. Walk through (face-list), applying X resource settings to the rest
    of the faces for this frame.

 4. Apply the frame parameter based face attributes describe above
    (foreground and background color, the default font, and the colors
    for the border, cursor, scroll-bar, and mouse).

As a result, set-face-attribute does not seem to change attributes on
future frames, other than the foreground and background color, contrary
to the description of internal-set-lisp-face-attribute.

How about this: change internal-set-lisp-face-attribute so that its only
role is to change the faces on existing frames, leaving the frame
parameters alone.  Then, handle the "saving for future frames" part in
the Lisp function set-face-attribute.  Maybe it should do this by
modifying face-new-frame-defaults and/or the defface spec.




  reply	other threads:[~2008-06-27 17:32 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 [this message]
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
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=877icardfs.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).