unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Is this "save practice" (setting default font scale)?
Date: Fri, 20 Nov 2020 16:37:51 +0100	[thread overview]
Message-ID: <AM0PR06MB65779CD715284CDFB98598DD96FF0@AM0PR06MB6577.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <83mtzcys9g.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 20 Nov 2020 17:14:51 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Date: Fri, 20 Nov 2020 15:51:04 +0100
>> 
>> Furthre investigation discovered a giant list of faces in Emacs:
>> face-new-frame-alist. Setting corresponding value in face vector for
>> 'default seems to achieve exactly same, but without measurable
>> difference at startup:
>> 
>> (aset (cdr (assoc 'default face-new-frame-defaults)) 4 160)
>> 
>> So my question is, is this safe to do, any pitfals I am not aware of
>> (more then me poking into internals which may change in future)?
>
> The pitfall is that the change in the default face will not be
> propagated to other faces that depend on 'default' (inherit from him
> and don't specify their own size explicitly).
Si, I understand. Does Daniel's answer (custom-set-face) have same problem?

> By "startup" do you mean a one-time occurrence, or do you see this
> slowdown each time you create a new frame via emacslient?
I have just measured startup time of Emacs; I almost never run multiple
frames, so I don't know.

I believe this would run after a new frame is created. This is the
original code, I have just refactored it somewhat since I really just
wanted to scale my fonts: 

(defun my-after-frame (frame)
    (if (display-graphic-p frame)
        (progn
            (add-to-list 'default-frame-alist '(font . "Anonymous Pro-16"))
            (set-face-attribute 'default nil :font "Anonymous Pro-16")
            (set-face-attribute 'default nil :height 160)
            (set-frame-font "Anonymous Pro-16" nil t))))

(add-hook 'after-make-frame-functions 'my-after-frame)

I guess this hook will repeat itself after every make-frame call? I
haven't measured, so it is just me guessing.

~200ms should also be taken with a grain of salt. I think my machine is
showing difference of everything from ~50 to ~200 ms for same setup; but
with after-frame hook it is always at least ~100 ms higher then without it.



  reply	other threads:[~2020-11-20 15:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 14:51 Is this "save practice" (setting default font scale)? Arthur Miller
2020-11-20 15:06 ` Daniele Nicolodi
2020-11-20 15:26   ` Arthur Miller
2020-11-20 15:14 ` Eli Zaretskii
2020-11-20 15:37   ` Arthur Miller [this message]
2020-11-20 20:05     ` Eli Zaretskii
2020-11-21  6:33       ` Arthur Miller
2020-11-20 22:47     ` chad
2020-11-21  6:43       ` Arthur Miller
2020-11-21  7:18         ` Manuel Uberti
2020-11-21 13:45           ` Arthur Miller
2020-11-21 16:04             ` Eli Zaretskii
2020-11-21 17:05               ` arthur miller
2020-11-20 15:52 ` Stefan Monnier
2020-11-21  6:12   ` Arthur Miller

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=AM0PR06MB65779CD715284CDFB98598DD96FF0@AM0PR06MB6577.eurprd06.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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).