Subject: Re: bug#17532: 24.4.50; Options > `set-frame-font' does not work as documented

From: Eli Zaretskii <[email-masked]>
Date: Wed, 21 May 2014 19:46:17 +0300

> Date: Tue, 20 May 2014 14:00:36 -0700 (PDT)
> From: Drew Adams <[email-masked]>
> Cc: [email-masked]
> 
> > Then this is expected behavior: selecting a new font from that menu
> > only changes the font for the existing frames, not for the future
> > ones.
> 
> That's not what the *doc* says.  You don't see that stated anywhere,
> do you?

I do.

> And why should that be the case?

Not relevant to the documentation issue.  (Personally, I think that
menu item should have changed the font only on the current frame, but
that's water under the bridge.)

> And what happens when you "save this for future sessions" (node
> Fonts)?

Not relevant to the issue (and IMO explained in the doc).

> What good could it do, and what meaning could it have, to save
> something that is only for existing frames (not new frames) in this
> session?

Fonts are attributes of faces, and faces are always frame-specific.
It is reasonable to give the user a possibility to change the font
only of some frames and not others.

> > > Anyway, when you use menu item `Set Default Font', it invokes `menu-set-font',
> > > which calls `set-frame-font' *non-interactively*, and with `t' as the
> > > value for FRAMES.
> > 
> > But that doesn't cover future frames, either.  It only affects the
> > existing GUI frames, per the doc string (and the code, which see).
>                        ^^^^^^^^^^^^^^^^^^
> 
> Where are you getting this?  `C-h f set-frame-font' says clearly:
> 
>    Also, if FRAME is non-nil, alter the user's Customization settings as
>    though the font-related attributes of the `default' face had been
>    "set in this session", so that the font is applied to future frames.
> 
> One of us seems to be sorely missing something. ;-)

You are missing the previous sentence of the doc string.  I have now
made it say clearly that only the existing frames are affected.

> (That's a typo, BTW: FRAME here should be FRAMES.)

Fixed.

> > > In addition, the doc string for `menu-set-font' says that it makes the
> > > font you choose "the default".  It does NOT at all suggest that it changes
> > > the font only for the current frame.  Similarly, the menu item itself speaks
> > > of "Default".
> > 
> > "Default font" means the font of the default face, that's all.  Yes,
> > that's ambiguous.
> 
> A face, including face `default', is not something that is frame-specific.

Faces are _always_ frame-specific in Emacs.  That includes the
'default' face.  Thus, changing the 'default' face does not imply the
change affects all frames, let alone future frames.

> > > It likens the behavior of `Set Default Font' to modifying `default-frame-
> > > alist'.
> > 
> > No, it doesn't mention default-frame-alist at all.
> 
> It most certainly does - the very next bullet!

The very next bullet is about a different method of changing the font,
so it's not really relevant to what this first bullet describes.

Anyway, I made the changes that clarify the current behavior.  The
part that seems to say that Customize settings are changed to affect
the font change on all future frames does not correspond to what
actually happens.  This could be a code bug or a documentation bug;
someone who can decipher the Customize-related code in set-frame-font
will have to look into this, and fix either the doc string or the code
as appropriate.  For now, I left that part of the doc string
unaltered.