GNU bug report logs - #67449
Manual: add how to change default global font size in .emacs

Previous Next

Package: emacs;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Sun, 26 Nov 2023 02:19:02 UTC

Severity: normal

Tags: notabug, wontfix

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67449 in the body.
You can then email your comments to 67449 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Sun, 26 Nov 2023 02:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 26 Nov 2023 02:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Manual: add how to change default global font size in .emacs
Date: Sun, 26 Nov 2023 10:18:16 +0800
In (info "(emacs) Fonts") we learn

> By default, Emacs displays text on graphical displays using a 10-point
> monospace font, and the font size can be changed interactively (*note
> Text Scale::).

That is great. But what is 10-point is not the right default size for 
you.

Well, to make a new defaut, just put
(global-text-scale-adjust INCREMENT)
in your .emacs. As simple as that.

But the manual never gets around to mentioning that.

So how shall we fix that problem?

Well first there on In (info "(emacs) Fonts") please add:

> besides interactively, the default can also be incremented in your
> .emacs file: via (global-text-scale-adjust INCREMENT).

OK, also in  (info "(emacs) Text Scale") we see

>  to change the sizes of the fonts globally, type ‘C-x
> C-M-+’, ‘C-x C-M-=’, ‘C-x C-M--’ or ‘C-x C-M-0’, or scroll the mouse
> wheel with both the ‘Ctrl’ and ‘Meta’ modifiers pressed.

That is also great, but you also need to mention how to change it
permanently in .emacs: via (global-text-scale-adjust INCREMENT).

In fact, that would make this index entry
* global-text-scale-adjust: Text Scale. (line  35)
make sense. As currently all it leads to are the keystrokes.

(Note: in all of the above I intentionally do not mention "Easy
customization". That is not what I am trying to document.)

P.S.,
emacs -Q --eval '(global-text-scale-adjust 0)' cause the initial text
to disappear.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Sun, 26 Nov 2023 05:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 67449 <at> debbugs.gnu.org
Subject: Re: bug#67449: Manual: add how to change default global font size in
 .emacs
Date: Sun, 26 Nov 2023 07:50:48 +0200
tags 67449 notabug wontfix
close 67449
thanks

> Date: Sun, 26 Nov 2023 10:18:16 +0800
> From: Dan Jacobson <jidanni <at> jidanni.org>
> 
> In (info "(emacs) Fonts") we learn
> 
> > By default, Emacs displays text on graphical displays using a 10-point
> > monospace font, and the font size can be changed interactively (*note
> > Text Scale::).
> 
> That is great. But what is 10-point is not the right default size for 
> you.

The text just below that explains how to do that in half a dozen
different ways.

> Well, to make a new defaut, just put
> (global-text-scale-adjust INCREMENT)
> in your .emacs. As simple as that.

No, that's not the right way, since it doesn't affect all the faces
used by Emacs.  You've misunderstood the intent and purpose of
global-text-scale-adjust and friends.

> OK, also in  (info "(emacs) Text Scale") we see
> 
> >  to change the sizes of the fonts globally, type ‘C-x
> > C-M-+’, ‘C-x C-M-=’, ‘C-x C-M--’ or ‘C-x C-M-0’, or scroll the mouse
> > wheel with both the ‘Ctrl’ and ‘Meta’ modifiers pressed.
> 
> That is also great, but you also need to mention how to change it
> permanently in .emacs: via (global-text-scale-adjust INCREMENT).

Because doing that permanently makes no sense, and that's not what
global-text-scale-adjust is for.

This is not a bug, and there's nothing we should do here.

Closing.




Added tag(s) wontfix and notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 26 Nov 2023 05:52:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 67449 <at> debbugs.gnu.org and Dan Jacobson <jidanni <at> jidanni.org> Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 26 Nov 2023 05:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Sun, 26 Nov 2023 13:29:02 GMT) Full text and rfc822 format available.

Message #15 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 67449 <at> debbugs.gnu.org
Subject: Re: bug#67449: Manual: add how to change default global font size in
 .emacs
Date: Sun, 26 Nov 2023 21:28:31 +0800
OK, so if "emacs' default font size is 10",
there is no way to make it e.g., 15.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Sun, 26 Nov 2023 13:51:02 GMT) Full text and rfc822 format available.

Message #18 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 67449 <at> debbugs.gnu.org
Subject: Re: bug#67449: Manual: add how to change default global font size in
 .emacs
Date: Sun, 26 Nov 2023 15:50:12 +0200
> Date: Sun, 26 Nov 2023 21:28:31 +0800
> From: Dan Jacobson <jidanni <at> jidanni.org>
> Cc: 67449 <at> debbugs.gnu.org
> 
> OK, so if "emacs' default font size is 10",
> there is no way to make it e.g., 15.

Yes, there is: see the manual, in the same node where you found the
description of the default.  There are 5 different ways of doing this
described there, two of them are suitable for customizing the font
Emacs will use as the default one, and recording that customization
once and for all.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Sun, 26 Nov 2023 20:56:02 GMT) Full text and rfc822 format available.

Message #21 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 67449 <at> debbugs.gnu.org
Subject: Re: bug#67449: Manual: add how to change default global font size in
 .emacs
Date: Mon, 27 Nov 2023 04:55:29 +0800
Fine. If there is a simple way, to change the default font size, one 
line that one can put in one's .emacs file, without needing to deal with 
the customization system, then please mention it, right there, below the 
line that says emacs's default font size is 10. Thank you.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Mon, 27 Nov 2023 03:28:01 GMT) Full text and rfc822 format available.

Message #24 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 67449 <at> debbugs.gnu.org
Subject: Re: bug#67449: Manual: add how to change default global font size in
 .emacs
Date: Mon, 27 Nov 2023 05:27:05 +0200
> Date: Mon, 27 Nov 2023 04:55:29 +0800
> From: Dan Jacobson <jidanni <at> jidanni.org>
> Cc: 67449 <at> debbugs.gnu.org
> 
> Fine. If there is a simple way, to change the default font size, one 
> line that one can put in one's .emacs file, without needing to deal with 
> the customization system, then please mention it, right there, below the 
> line that says emacs's default font size is 10. Thank you.

It's already mentioned there.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Wed, 29 Nov 2023 03:11:02 GMT) Full text and rfc822 format available.

Message #27 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 67449 <at> debbugs.gnu.org
Subject: Re: bug#67449: Manual: add how to change default global font size
 in .emacs
Date: Wed, 29 Nov 2023 11:10:09 +0800
In (info "(emacs) Fonts")

> File: emacs.info,  Node: Fonts,  Next: Speedbar,  Prev: Frame Commands,  Up: Frames
> 
> 22.8 Fonts
> ==========
> 
> By default, Emacs displays text on graphical displays using a 10-point

10 point. Let's say we want it to use 14 point default.

> monospace font,

We don't care about monospace or not. We just want to make 10 into 14.


> and the font size can be changed interactively (*note
> Text Scale::).

We don't want to change it interactively. We just want to put a line in
our .emacs file to change it.

>    There are several different ways to specify a different font:

We don't want to specify a different font. We don't care about the font.
We just want to make it use a different size as default.

>    • Click on ‘Set Default Font’ in the ‘Options’ menu.  This makes the
>      selected font the default on all existing graphical frames.  To
>      save this for future sessions, click on ‘Save Options’ in the
>      ‘Options’ menu.

We don't want to click on anything. Nor do we want to choose a font. We
just want to change the default size for emacs of fonts.

> 
>    • Add a line to your init file, modifying the variable
>      ‘default-frame-alist’ to specify the ‘font’ parameter (*note Frame
>      Parameters::), like this:
> 
>           (add-to-list 'default-frame-alist
>                        '(font . "DejaVu Sans Mono-10"))

Yes we want to add a line to our .emacs file. But we don't want to have
to say some font name. We just want to tell emacs to use "default size
14, not 10".


> 
>      This makes the font the default on all graphical frames created
>      after restarting Emacs with that init file.
> 
>    • Add an ‘emacs.font’ X resource setting to your X resource file,
>      like this:
> 
>           emacs.font: DejaVu Sans Mono-12

Again we are forced to name a font. We don't want to name a font. We
just want to tell emacs to do what it does, but at scale 14 not 10.

Anyway maybe there is a glimmer of hope with some line like
-*-*-*-14-*-*-*- or something, but it so frustrating. Whereas in other
apps one can just choose a default font size, in emacs ... well you have
to go down to the car dealership and learn about muffler types. You
can't just tell the rental agency to deliver an economy sized car.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Wed, 29 Nov 2023 12:48:02 GMT) Full text and rfc822 format available.

Message #30 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 67449 <at> debbugs.gnu.org
Subject: Re: bug#67449: Manual: add how to change default global font size
 in .emacs
Date: Wed, 29 Nov 2023 14:47:16 +0200
> From: Dan Jacobson <jidanni <at> jidanni.org>
> Cc: 67449 <at> debbugs.gnu.org
> Date: Wed, 29 Nov 2023 11:10:09 +0800
> 
> In (info "(emacs) Fonts")
> 
> > File: emacs.info,  Node: Fonts,  Next: Speedbar,  Prev: Frame Commands,  Up: Frames
> > 
> > 22.8 Fonts
> > ==========
> > 
> > By default, Emacs displays text on graphical displays using a 10-point
> 
> 10 point. Let's say we want it to use 14 point default.
> 
> > monospace font,
> 
> We don't care about monospace or not. We just want to make 10 into 14.

Monospace is the default, so it doesn't matter whether "we" care or
not.

> > and the font size can be changed interactively (*note
> > Text Scale::).
> 
> We don't want to change it interactively. We just want to put a line in
> our .emacs file to change it.
> 
> >    There are several different ways to specify a different font:
> 
> We don't want to specify a different font. We don't care about the font.
> We just want to make it use a different size as default.

So just specify the same font with the different size.  Case closed.

> >    • Add a line to your init file, modifying the variable
> >      ‘default-frame-alist’ to specify the ‘font’ parameter (*note Frame
> >      Parameters::), like this:
> > 
> >           (add-to-list 'default-frame-alist
> >                        '(font . "DejaVu Sans Mono-10"))
> 
> Yes we want to add a line to our .emacs file. But we don't want to have
> to say some font name. We just want to tell emacs to use "default size
> 14, not 10".

So just specify the same font with the different size.  Case closed.

> >      This makes the font the default on all graphical frames created
> >      after restarting Emacs with that init file.
> > 
> >    • Add an ‘emacs.font’ X resource setting to your X resource file,
> >      like this:
> > 
> >           emacs.font: DejaVu Sans Mono-12
> 
> Again we are forced to name a font. We don't want to name a font. We
> just want to tell emacs to do what it does, but at scale 14 not 10.

So just specify the same font with the different size.  Case closed.

> Anyway maybe there is a glimmer of hope with some line like
> -*-*-*-14-*-*-*- or something, but it so frustrating.

A two-liner in the init file or a X resource setting cannot be
anywhere near frustrating.

> Whereas in other apps one can just choose a default font size, in
> emacs ... well you have to go down to the car dealership and learn
> about muffler types. You can't just tell the rental agency to
> deliver an economy sized car.

Or you can do the above, which is easy and a no-brainer, really.  Case
closed.  And this bug is also closed.  Please accept the decision and
stop pushing.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Thu, 30 Nov 2023 07:24:02 GMT) Full text and rfc822 format available.

Message #33 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 67449 <at> debbugs.gnu.org, Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#67449: Manual: add how to change default global font size
 in .emacs
Date: Thu, 30 Nov 2023 08:23:00 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> > and the font size can be changed interactively (*note
>> > Text Scale::).
>> 
>> We don't want to change it interactively. We just want to put a line in
>> our .emacs file to change it.
>> 
>> >    There are several different ways to specify a different font:
>> 
>> We don't want to specify a different font. We don't care about the font.
>> We just want to make it use a different size as default.
>
> So just specify the same font with the different size.  Case closed.
>
>> >    • Add a line to your init file, modifying the variable
>> >      ‘default-frame-alist’ to specify the ‘font’ parameter (*note Frame
>> >      Parameters::), like this:
>> > 
>> >           (add-to-list 'default-frame-alist
>> >                        '(font . "DejaVu Sans Mono-10"))
>> 
>> Yes we want to add a line to our .emacs file. But we don't want to have
>> to say some font name. We just want to tell emacs to use "default size
>> 14, not 10".
>
> So just specify the same font with the different size.  Case closed.
>
>> >      This makes the font the default on all graphical frames created
>> >      after restarting Emacs with that init file.
>> > 
>> >    • Add an ‘emacs.font’ X resource setting to your X resource file,
>> >      like this:
>> > 
>> >           emacs.font: DejaVu Sans Mono-12
>> 
>> Again we are forced to name a font. We don't want to name a font. We
>> just want to tell emacs to do what it does, but at scale 14 not 10.
>
> So just specify the same font with the different size.  Case closed.
>
>> Anyway maybe there is a glimmer of hope with some line like
>> -*-*-*-14-*-*-*- or something, but it so frustrating.
>
> A two-liner in the init file or a X resource setting cannot be
> anywhere near frustrating.
>
>> Whereas in other apps one can just choose a default font size, in
>> emacs ... well you have to go down to the car dealership and learn
>> about muffler types. You can't just tell the rental agency to
>> deliver an economy sized car.
>
> Or you can do the above, which is easy and a no-brainer, really.  Case
> closed.  And this bug is also closed.  Please accept the decision and
> stop pushing.

FWIW, I've been following this thread because I empathize with Dan in
this report: depending on the system I use, emacs -Q gets me either
Ubuntu Mono (GNOME/Ubuntu 22.04), Noto Sans Mono (Plasma/Debian 12) or
Source Code Pro (Plasma/openSUSE Tumbleweed).

In practice I customize Emacs to pick DejaVu Sans Mono in every setup,
but that's a decision I take for incidental reasons (character coverage,
bold/italic variants); so indeed I happen to

> just specify the same font

but I can imagine wanting to keep the system's default _family_, yet
have a consistent font _size_ across all my setups, in which case having
to spell out the font in my dotfiles is a bother.

(Granted, the X resource solution cited above might work?  Would it work
--with-pgtk on Wayland?)

(Granted², as soon as each "setup" differs in screen size, resolution,
or density, "a consistent font _size_ across all my setups" probably
requires bespoke face heights for each setup; still, that does not mean
I'd want to mess with the _family_)

FWIW², if I were to attempt to "just set the size, ignoring the font" in
my dotfiles, I'd probably go with either

  ;; (1)
  (set-face-attribute 'default nil :height my/height)

or

  ;; (2)
  (let* ((family (face-attribute 'default :family))
         (font-desc (format "%s-%s" family my/size)))
    (add-to-list 'default-frame-alist
                 (cons 'font font-desc)))

?  Not saying that's worth documenting, just hoping that'll help Dan
sort out his config.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Thu, 30 Nov 2023 08:41:01 GMT) Full text and rfc822 format available.

Message #36 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Cc: 67449 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#67449: Manual: add how to change default global font size
 in .emacs
Date: Thu, 30 Nov 2023 10:39:55 +0200
> From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
> Cc: Dan Jacobson <jidanni <at> jidanni.org>,  67449 <at> debbugs.gnu.org
> Date: Thu, 30 Nov 2023 08:23:00 +0100
> 
> > just specify the same font
> 
> but I can imagine wanting to keep the system's default _family_, yet
> have a consistent font _size_ across all my setups, in which case having
> to spell out the font in my dotfiles is a bother.

I don't see why it should be a bother.  That same node of the manual
says a bit later:

     To check what font you're currently using, the ‘C-u C-x =’ command
  can be helpful.  It describes the character at point, and names the font
  that it's rendered in.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Sat, 02 Dec 2023 03:17:01 GMT) Full text and rfc822 format available.

Message #39 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 67449 <at> debbugs.gnu.org,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Subject: Re: bug#67449: Manual: add how to change default global font size in
 .emacs
Date: Sat, 02 Dec 2023 11:16:14 +0800
So the default size "10" must be buried in the C source code, and if
the user wants to change *it* they must recompile emacs.
Too bad.

P.S.,
$ emacs -Q -eval "(set-face-attribute 'default nil :height (* 18 6))"
tests great! (Except I found I needed to multiply any value I wanted by
six, in order to get that value. At least on a Chromebook.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67449; Package emacs. (Sat, 02 Dec 2023 07:43:01 GMT) Full text and rfc822 format available.

Message #42 received at 67449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 67449 <at> debbugs.gnu.org, kevin.legouguec <at> gmail.com
Subject: Re: bug#67449: Manual: add how to change default global font size in
 .emacs
Date: Sat, 02 Dec 2023 09:42:25 +0200
> Date: Sat, 02 Dec 2023 11:16:14 +0800
> From: Dan Jacobson <jidanni <at> jidanni.org>
> Cc: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>,
>  67449 <at> debbugs.gnu.org
> 
> So the default size "10" must be buried in the C source code, and if
> the user wants to change *it* they must recompile emacs.
> Too bad.

It isn't too bad, since the default size can be customized, as
explained by that section of the manual.

> $ emacs -Q -eval "(set-face-attribute 'default nil :height (* 18 6))"
> tests great! (Except I found I needed to multiply any value I wanted by
> six, in order to get that value. At least on a Chromebook.)

The section "Frame Parameters" explains how to do this for the init
file.  (The section "Fonts", which started this discussion, has a
hyper-link to "Frame Parameters".)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 Dec 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.