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: Sun, 29 Jun 2008 14:00:46 -0400	[thread overview]
Message-ID: <jwv7ic8f7mw.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87prq0z2jd.fsf@stupidchicken.com> (Chong Yidong's message of "Sun, 29 Jun 2008 11:25:26 -0400")

> Typo.  I meant to use the font attribute of the default face in the new
> frame:

> *** trunk/lisp/faces.el.~1.416.~	2008-06-28 22:14:35.000000000 -0400
> --- trunk/lisp/faces.el	2008-06-29 11:11:35.000000000 -0400
> ***************
> *** 2056,2061 ****
> --- 2056,2065 ----
>   		(make-face-x-resource-internal face frame))
>   	    (internal-merge-in-global-face face frame))
>   	(error nil)))
> +     ;; The face specs may specify a different default font.  Save this
> +     ;; in the `font' frame parameter.
> +     (when (face-font 'default frame)
> +       (set-frame-parameter frame 'font (face-font 'default frame)))
>       ;; Apply the attributes specified by frame parameters.  This
>       ;; rewrites parameters changed by make-face-x-resource-internal
>       (dolist (param apply-params)

> The point is that the default face in the new frame specifies a font
> (based on its family, slant, and weight attributes) that may differ from
> the `font' frame parameter.  In that case, it's the former we should
> use.  The call to face-font returns a font object consistent with the
> attributes of the default face.  Any font-parameter supplied by the user
> further overrides this.  Make sense?

Yes, it makes a bit more sense, except that now I wonder why this
code would be needed at all?  Isn't the `font' frame-parameter
automatically always kept up-to-date with the font of the
`default' face?  If not, I think it should, and hence it should be done
elsewhere so that it's also true when we later change the default face
via `set-face-attributes' or something like that.

>> It appears to read some of the settings for the `default' face from
>> face-new-frame-defaults and then applies them to the `default' face on
>> the current frame.  This seems both useless and dubious:
>> face-new-frame-defaults is presumably obeyed elsewhere already, and
>> why should we only play with the `font' part of the `default' face?

> Not sure.  It's possible that some of the operations in
> face-new-frame-defaults need some information in the default face,
> e.g. to figure out column widths, even if that information is later
> revised.

I do not follow.  AFAIK, there are no operations in
face-new-frame-defaults, and I have no idea what column width come
into play.  Can you give a concrete example, maybe?

>> - apply defface
>> - apply Xresources
>> - apply face-new-frame-defaults
>> - apply frame-parameters
>> 
>> The first 3 will always return the exact same result for every frame on
>> the same terminal (at least, if we ignore frame-specific Xresource
>> settings).
>> 
>> So I don't see why we can't just precompute this result at
>> terminal-creation time and store it directly in face-new-frame-defaults
>> (after making this variable terminal-local).

> Now I see your point.

> The problem with this proposal is that if Lisp code changes the defface
> spec, we would need to update this value by recomputing X resources,
> face-new-frame-defaults, etc etc.  Since we allow Lisp code to access
> defface specs as Lisp lists instead of using accessor functions, I don't
> see how to handle this.

I don't understand how that's relevant: the same problem exists
already today, doesn't it?


        Stefan





  reply	other threads:[~2008-06-29 18:00 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
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 [this message]
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=jwv7ic8f7mw.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).