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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 20 May 2014 22:54:17 +0300

> Date: Tue, 20 May 2014 10:49:13 -0700 (PDT)
> From: Drew Adams <[email-masked]>
> Cc: [email-masked]
> 
> > > emacs -Q
> > >
> > > M-: (setq default-frame-alist '
> > >  ((font . "-outline-Lucida
> > >  Console-normal-normal-normal-mono-3-*-*-*-c-*-iso8859-1")))
> > >
> > > or some other font that is different from the default emacs -Q font.
> > >
> > > Choose menu item Options > Set Default Font..., and choose yet another
> > > font.
> > >
> > > C-x 4 d RET ; or another command to display another buffer
> 
> I should have said:
> 
> C-x 5 d RET ; or another command to display another buffer in a new frame
>     ^                                                      ^^^^^^^^^^^^^^
> 
> You can also try C-x 5 b *Messages*, for instance, to see *Messages* in a new frame.
> 
> This is about `default-frame-alist', as it applies to a new frame.

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.

> > > The newly displayed buffer's font is not the font you chose using Set
> > > Default Font.
> > 
> > I cannot reproduce this with today's trunk: I get the same font as the
> > one I've chosen from the menu using Set Default Font.
> 
> I don't. I get the one that I set in `default-frame-alist'.

As expected.

> Except that the size is shrunk *way* down, for some reason (another bug,
> presumably).

I think that's what you asked for, by that "-3-" part in the font
spec.  That's way too small.

> 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).

> 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.

> > > Note that the doc here includes (emacs) `Fonts'.
> > 
> > That doesn't seem to imply the font is changed on all frames, either.
> 
> It says that when you use `Set Default Font' you are changing a user
> option (although it doesn't tell you which one!).  It suggests that this
> is for the session generally (it says that for the setting to work also
> for future sessions you need to save it).

I don't see how you deduce that.  The text is very simple:

  21.8 Fonts
  ==========

  By default, Emacs displays text on graphical displays using a 12-point
  monospace font.  There are several different ways to specify a
  different font:

     * Click on `Set Default Font' in the `Options' menu.  To save this
       for future sessions, click on `Save Options' in the `Options' menu.

Unless you are saying that saving the options doesn't make this font
the default in future sessions, I see nothing wrong or misleading with
this text (except that the default font is not 12-point, not for many
years; I will fix that).

> It likens the behavior of `Set Default Font' to modifying `default-frame-alist'.

No, it doesn't mention default-frame-alist at all.