all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matt Armstrong <matt@rfc20.org>
To: Po Lu <luangruo@yahoo.com>, Dmitry Gutov <dgutov@yandex.ru>
Cc: Eli Zaretskii <eliz@gnu.org>, 58912@debbugs.gnu.org
Subject: bug#58912: 29.0.50; set-face-attribute call in init.el has no lasting effect
Date: Mon, 31 Oct 2022 19:20:45 -0700	[thread overview]
Message-ID: <87r0yns9du.fsf@rfc20.org> (raw)
In-Reply-To: <87iljzh4ia.fsf@yahoo.com>

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.





  reply	other threads:[~2022-11-01  2:20 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 [this message]
2022-11-01  2:58               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0yns9du.fsf@rfc20.org \
    --to=matt@rfc20.org \
    --cc=58912@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.