GNU bug report logs -
#79772
[PATCH] [NS] macfont.m - cache font family misses
Previous Next
To reply to this bug, email your comments to 79772 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79772; Package
emacs.
(Wed, 05 Nov 2025 18:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Przemysław Alexander Kamiński <alexander <at> kaminski.se>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Wed, 05 Nov 2025 18:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This patch caches nil result for macfont queries. Not sure where they
might come from, but many nil results were retried.
This patch changes caching mechanism so that not only hits, but also
misses are cached.
Extra remarks:
- Problem could be amplified by number of fonts installed on user's system
- Consequence of caching misses is not picking up newly installed fonts
until Emacs restart
- (on the other hand caching mechanism could return false positive
today after font deletion)
This patch is stable - I've been running it for more than 2 months
without any issues.
--
Przemysław Alexander Kamiński (vel xlii vel exlee)
https://xlii.space || https://codeberg.org/exlee
[cache_all_font_results_0001.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79772; Package
emacs.
(Wed, 05 Nov 2025 18:25:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 79772 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Wed, Nov 5, 2025 at 1:18 PM Przemysław Alexander Kamiński <
alexander <at> kaminski.se> wrote:
> This patch caches nil result for macfont queries. Not sure where they
> might come from, but many nil results were retried.
>
> This patch changes caching mechanism so that not only hits, but also
> misses are cached.
>
> Extra remarks:
> - Problem could be amplified by number of fonts installed on user's system
> - Consequence of caching misses is not picking up newly installed fonts
> until Emacs restart
> - (on the other hand caching mechanism could return false positive
> today after font deletion)
>
> This patch is stable - I've been running it for more than 2 months
> without any issues.
>
I occasionally install new fonts and prefer not to restart. Perhaps we
need a Lisp-callable command to invalidate the cache (or invalidate all NS
caches?).
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79772; Package
emacs.
(Wed, 05 Nov 2025 18:37:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 79772 <at> debbugs.gnu.org (full text, mbox):
--
On Wed, Nov 05, 2025 at 13:24:38 (-0500), Stéphane Marks wrote:
> I occasionally install new fonts and prefer not to restart. Perhaps we
> need a Lisp-callable command to invalidate the cache (or invalidate all NS
> caches?).
It makes sense, but I think the only scenario where this would happen
would be trying to use font before it's installed.
The other patch (caching full font list) might trigger such
problem. I'll look into hooking these caches to garbage collection
instead.
--
Przemysław Alexander Kamiński (vel xlii vel exlee)
https://xlii.space || https://codeberg.org/exlee
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79772; Package
emacs.
(Wed, 05 Nov 2025 18:48:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 79772 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Wed, Nov 5, 2025 at 1:36 PM Przemysław Alexander Kamiński <
alexander <at> kaminski.se> wrote:
> --
> On Wed, Nov 05, 2025 at 13:24:38 (-0500), Stéphane Marks wrote:
>
> > I occasionally install new fonts and prefer not to restart. Perhaps we
> > need a Lisp-callable command to invalidate the cache (or invalidate all
> NS
> > caches?).
>
> It makes sense, but I think the only scenario where this would happen
> would be trying to use font before it's installed.
>
> The other patch (caching full font list) might trigger such
> problem. I'll look into hooking these caches to garbage collection
> instead.
>
I will also delete a font if I don't like it, simple as
~/rm/Library/Fonts/blah.ttf so the cache would need to not barf if the font
disappeared, though I do not know if there would be other issues. I do this
infrequently enough that I could restart or invalidate the cache manually,
if needed.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79772; Package
emacs.
(Wed, 05 Nov 2025 19:36:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 79772 <at> debbugs.gnu.org (full text, mbox):
> Cc: 79772 <at> debbugs.gnu.org
> From: Stéphane Marks <shipmints <at> gmail.com>
> Date: Wed, 5 Nov 2025 13:24:38 -0500
>
> On Wed, Nov 5, 2025 at 1:18 PM Przemysław Alexander Kamiński <alexander <at> kaminski.se> wrote:
>
> This patch caches nil result for macfont queries. Not sure where they
> might come from, but many nil results were retried.
>
> This patch changes caching mechanism so that not only hits, but also
> misses are cached.
>
> Extra remarks:
> - Problem could be amplified by number of fonts installed on user's system
> - Consequence of caching misses is not picking up newly installed fonts
> until Emacs restart
> - (on the other hand caching mechanism could return false positive
> today after font deletion)
>
> This patch is stable - I've been running it for more than 2 months
> without any issues.
>
> I occasionally install new fonts and prefer not to restart. Perhaps we need a Lisp-callable command to
> invalidate the cache (or invalidate all NS caches?).
Yes, these considerations are indeed the disadvantage of caching
font-related information inside Emacs.
Why does NS need to cache this whereas other font backends don't?
What is special about the NS font backend?
This bug report was last modified 6 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.