unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kirill Ignatiev <kirill.ignatiev@gmail.com>
To: 19408@debbugs.gnu.org
Subject: bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings
Date: Thu, 18 Dec 2014 15:26:19 -0500	[thread overview]
Message-ID: <CACe-pWz=KzEeO5ws1QnCvfsUUL-gyA39uKJO1UMA73RbJd+67w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]

Take the following .emacs file:

(custom-set-faces
 '(default ((t (:inherit nil :height 110 :foundry "nil" :family
"Source Code Pro")))))

(add-to-list 'face-font-rescale-alist (cons (font-spec :family
"STIXGeneral") 0.95) t)

Run emacs with no other customizations, using -Q -l <file.el>. The
font in the initial frame in the scratch buffer will be Source Code
Pro, as expected. Open a new frame, the font in that frame will be
some other font (in my case Helvetica), not the default one.

During startup, if face-font-rescale-alist changes, emacs will mangle
the default font setting, causing it to be wrong for all non-initial
frames.

I found the following workaround:

;; Workaround for emacs/lisp/startup.el:670
(defadvice frame-notice-user-settings (before my:rescale-alist)
  ;; (message "Set face-font-rescale-alist")
  (add-to-list 'face-font-rescale-alist
      (cons (font-spec :family "STIXGeneral") 0.95) t))
(ad-activate 'frame-notice-user-settings)

for this particular bit of lisp/startup.el (line ~660)

 ;; FIXME: The user's init file may change
 ;; face-font-rescale-alist.  However, the default face
 ;; already has an assigned font object, which does not take
 ;; face-font-rescale-alist into account.  For such
 ;; situations, we ought to have a way to find all font
 ;; objects and regenerate them; currently we do not.  As a
 ;; workaround, we specifically reset te default face's :font
 ;; attribute here.  See bug#1785.
 (unless (eq face-font-rescale-alist
     old-face-font-rescale-alist)
   (set-face-attribute 'default nil :font (font-spec)))

I am not sure how the default font should be regenerated in case it's
affected by face-font-rescale-alist, but using (font-spec) is wrong
because it resets user's own settings.

I attached the output of report-emacs-bug.

[-- Attachment #2: report-emacs-bug.txt --]
[-- Type: text/plain, Size: 2394 bytes --]


In GNU Emacs 25.0.50.32 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F34))
 of 2014-12-16 on dhcp1-38.red.sandbox
Repository revision: d08f4f8fc5219324ac352c6d89f0db5c6a18ce32
Windowing system distributor `Apple', version 10.3.1265
Configured using:
 `configure --with-ns --without-sound CPPFLAGS=-I/sw/include
 LDFLAGS=-L/sw/lib'

Configured features:
ACL LIBXML2 ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Type C-x 1 to delete the help window.
Making completion list...
Mark set
"25.0.50.32"

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils vc-git diff-mode easy-mmode help-mode
easymenu advice help-fns time-date tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
cocoa ns multi-tty emacs)

Memory information:
((conses 16 84880 8004)
 (symbols 48 19497 1)
 (miscs 40 99 214)
 (strings 32 15805 4810)
 (string-bytes 1 387443)
 (vectors 16 10556)
 (vector-slots 8 399657 6002)
 (floats 8 63 93)
 (intervals 56 572 0)
 (buffers 976 15))

             reply	other threads:[~2014-12-18 20:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 20:26 Kirill Ignatiev [this message]
2020-12-03 12:20 ` bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings Lars Ingebrigtsen
2020-12-03 12:53   ` Kirill Ignatiev
2020-12-03 12:58     ` Lars Ingebrigtsen

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='CACe-pWz=KzEeO5ws1QnCvfsUUL-gyA39uKJO1UMA73RbJd+67w@mail.gmail.com' \
    --to=kirill.ignatiev@gmail.com \
    --cc=19408@debbugs.gnu.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).