unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Matt Armstrong <matt@rfc20.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	58912@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#58912: 29.0.50; set-face-attribute call in init.el has no lasting effect
Date: Tue, 01 Nov 2022 10:58:22 +0800	[thread overview]
Message-ID: <875yfzgz3l.fsf@yahoo.com> (raw)
In-Reply-To: <87r0yns9du.fsf@rfc20.org> (Matt Armstrong's message of "Mon, 31 Oct 2022 19:20:45 -0700")

Matt Armstrong <matt@rfc20.org> writes:

> I see the same symptoms as Dmitry.  I'm running a current Debian Testing
> system, Gnome, Wayland.
>
> Namely:
>
> 1) emacs -Q --> the 'default font family is the Gnome system monospace font.
>
> 2) emacs -Q -l test.el --> still uses the Gnome system mono font despite
>    setting the 'default face otherwise early in init.
>
> I changed the .el file to this:
>
>     (set-face-attribute
>      'default nil :height 110 :weight 'semi-light :family
>      "Cascadia Mono")
>     (debug-on-entry #'set-face-attribute)
>
> And the origin of the font change back to the system defaults is this:
>
>     Debugger entered--entering a function:
>     * set-face-attribute(default #<frame *scratch* - GNU Emacs at naz 0x55ad505df290> :width normal :weight normal :slant normal :font "Go Mono 11")
>       font-setting-change-default-font(":0" nil)
>       dynamic-setting-handle-config-changed-event((config-changed-event font-render ":0"))
>       funcall-interactively(dynamic-setting-handle-config-changed-event (config-changed-event font-render ":0"))
>       call-interactively(dynamic-setting-handle-config-changed-event nil [(config-changed-event font-render ":0")])
>       command-execute(dynamic-setting-handle-config-changed-event nil [(config-changed-event font-render ":0")] t)
>
> It looks like `font-setting-change-default-font' is pulling the system
> font (in my case "Go Mono") from the frame, which probably wasn't
> modified by the earlier `set-face-attribute` call.  To confirm I changed
> test.el to this:
>
>     (set-face-attribute
>      'default nil :height 110 :weight 'semi-light :family
>      "Cascadia Mono")
>     (dolist (frame (frame-list))
>       (let ((frame-font
>              (or (font-get (face-attribute 'default :font frame 'default)
>                            :user-spec)
>                  (frame-parameter frame 'font-parameter))))
>         (message "frame %S frame-font %S" frame frame-font)))
>
> And re-run "emacs -Q -l test.el" and get this in *Messages*:
>
>     frame #<frame *scratch* - GNU Emacs at naz 0x55d8362ca7f0> frame-font "Go Mono 11"
>
> So I change test.el yet again to have only this:
>
>     (set-frame-font "Cascadia Mono")
>
> ...and that font change sticks.  `set-frame-font` is what is called by
> the Options -> Set Default Font menu item and has logic to walk through
> frames and set their parameters accordingly.
>
> And again to have only this:
>
>     (set-frame-font (font-spec :height 110
>                                :weight 'semi-light
>                                :family "Cascadia Mono"))
>
>
> ...I wonder if setting the 'default face attribute in 'early-init.el'
> would be enough, too.

Doesn't it only do that if font-use-system-font is t?  Here is the
relevant part of dynamic-setting.el:

	;; Just redraw the existing fonts on all frames:
	(dolist (f frame-list)
	  (let ((frame-font
		 (or (font-get (face-attribute 'default :font f 'default)
			       :user-spec) <=====

this should return "Cascadia Mono"... what does it return for you?





  reply	other threads:[~2022-11-01  2:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31  0:44 bug#58912: 29.0.50; set-face-attribute call in init.el has no lasting effect Dmitry Gutov
2022-10-31 13:32 ` Eli Zaretskii
2022-10-31 13:57   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-31 14:11     ` Dmitry Gutov
2022-11-01  0:32       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-01  0:56         ` Dmitry Gutov
2022-11-01  1:01           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-01  2:20             ` Matt Armstrong
2022-11-01  2:58               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-11-02 21:55                 ` Matt Armstrong
2022-11-03  6:23                   ` Eli Zaretskii
2022-11-03  7:17                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-03  8:38                       ` Eli Zaretskii
2022-11-03 11:09                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-05 18:50                     ` Matt Armstrong
2022-11-05 19:03                       ` Eli Zaretskii
2022-11-01 10:25             ` Dmitry Gutov
2022-11-01 10:34               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-02 21:12                 ` Matt Armstrong
2022-11-19  6:02               ` bug#58912: bug#59283: 29.0.50; `custom-set-faces' does not respect :height when set on start-up Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-19 14:10                 ` Dmitry Gutov
2022-11-20  0:34                   ` bug#59283: " Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-01 17:34             ` bug#58912: 29.0.50; set-face-attribute call in init.el has no lasting effect Juri Linkov
2022-11-02  0:54               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-02 17:24                 ` Juri Linkov
2022-11-08 18:56               ` Juri Linkov

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=875yfzgz3l.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58912@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=matt@rfc20.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).