From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs 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 Message-ID: <87r0yns9du.fsf@rfc20.org> References: <83sfj4dsp0.fsf@gnu.org> <878rkwhz8o.fsf@yahoo.com> <63430cc7-d940-41c9-4c14-0ff6867134e4@yandex.ru> <874jvjiked.fsf@yahoo.com> <87iljzh4ia.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5411"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 58912@debbugs.gnu.org To: Po Lu , Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 01 03:21:14 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opgtu-0001BI-BW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Nov 2022 03:21:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opgtl-0005z0-22; Mon, 31 Oct 2022 22:21:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opgti-0005yn-Pd for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 22:21:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opgti-0002dM-Ek for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 22:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opgti-0001xm-6Z for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 22:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Nov 2022 02:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58912 X-GNU-PR-Package: emacs Original-Received: via spool by 58912-submit@debbugs.gnu.org id=B58912.16672692577516 (code B ref 58912); Tue, 01 Nov 2022 02:21:02 +0000 Original-Received: (at 58912) by debbugs.gnu.org; 1 Nov 2022 02:20:57 +0000 Original-Received: from localhost ([127.0.0.1]:42340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opgtc-0001x9-Qh for submit@debbugs.gnu.org; Mon, 31 Oct 2022 22:20:57 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:45867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opgtb-0001wu-5T for 58912@debbugs.gnu.org; Mon, 31 Oct 2022 22:20:55 -0400 Original-Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id 852B060006; Tue, 1 Nov 2022 02:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1; t=1667269249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=B9uFpjyyuJqyWRQFppibVjFadajUwIEJWUDvIwCvdsM=; b=Bu47ElwuzaRQkfV6b42almmksiWF9h8NdQli9YnK1qwueUkrKsnvyhuKOYUmLJOyBeHKOK iq9Dg9xzqTEINfmrZG8vayYnJaIDtyVlGzPvrON7ADW7YoUKQlitdETyqF/WX+R4K4Jzj3 iZfOhEaOLWA1xrp3SEO7Bd2w/9ayGCDEqIdiAy+57WeKOz3eeYkfHlkltNjoyonR8oCSD5 X0YVApMlQq8NUIZB8lNcdloFXqCbU81ccQ+TvMJ3OphVEs6HuHDMa6n4jomnJmLBkSSK27 Nb6fOi+pHzV62Z3a4qB//5O9UpeFyk3ihBb2aSa9wn4yR+1/ZFWKS0X3hFHoRg== Original-Received: from matt by naz with local (Exim 4.96) (envelope-from ) id 1opgtR-00035U-2X; Mon, 31 Oct 2022 19:20:45 -0700 In-Reply-To: <87iljzh4ia.fsf@yahoo.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246739 Archived-At: 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 # :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-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.