[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:26:08 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Daniele Nicolodi <daniele@grinta.net> writes:
> On 20/11/2020 15:51, Arthur Miller wrote:
>> For few years now I have been using this to set default font height
>> in my .emacs, as told by Mr. Eliz some few years ago in some social
>> media thread:
>>
>> (add-hook 'after-make-frame-functions
>> (lambda (frame)
>> (set-face-attribute 'default nil :height 160)))
>>
>> This also seem to be THE way to customize fonts as found on numerous
>> SX/Reddit/blogs/etc discussions. So far so good.
>>
>> I have refactored my init file and trying to push some things to
>> early-init to save some load time. What I have found is that above
>> little code adds ~200 ms to the init time; take or give.
>>
>> Maybe it shouldn't but I have profiled several times and it always add
>> to startup time.
>>
>> 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)?
>
> I think the recommended way to change face properties is via the
> customize facility, thus through the the custom-set-faces function:
>
> (custom-set-faces '(default ((t (:height 160)))))
Oki, it seems to achieve same result at about same speed too.
It is slightly more complicated; it calls custom-theme-set-faces under
the hood, but at least on my computer I can't seem to be able to measure
the time difference. Seems that every startup varies somewhere around
~100 ms, with both versions I am getting startups 0.32 ~ 0.34 secs.
custom-set-faces seems to be slightly more descriptive, than setting
value directly so I'll probably go with it; thanks!
- Is this "save practice" (setting default font scale)?, Arthur Miller, 2020/11/20
- Re: Is this "save practice" (setting default font scale)?, Daniele Nicolodi, 2020/11/20
- Re: Is this "save practice" (setting default font scale)?,
Arthur Miller <=
- Re: Is this "save practice" (setting default font scale)?, Eli Zaretskii, 2020/11/20
- Re: Is this "save practice" (setting default font scale)?, Arthur Miller, 2020/11/20
- Re: Is this "save practice" (setting default font scale)?, chad, 2020/11/20
- Re: Is this "save practice" (setting default font scale)?, Arthur Miller, 2020/11/21
- Re: Is this "save practice" (setting default font scale)?, Manuel Uberti, 2020/11/21
- Re: Is this "save practice" (setting default font scale)?, Arthur Miller, 2020/11/21
- Re: Is this "save practice" (setting default font scale)?, Eli Zaretskii, 2020/11/21
- RE: Is this "save practice" (setting default font scale)?, arthur miller, 2020/11/21