emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this "save practice" (setting default font scale)?


From: Arthur Miller
Subject: Re: Is this "save practice" (setting default font scale)?
Date: Fri, 20 Nov 2020 16:37:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]