syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

[unicode-fonts] mapping unicode blocks on every Spacemacs start (Emacs 29 - pcache issue) #15498

Closed practicalli-johnny closed 2 years ago

practicalli-johnny commented 2 years ago

Description :octocat:

Unicode font mapping each time Spacemacs is started, rather than being cached

Spacemacs can take up to a minute to start due to a process that maps unicode blocks on fonts and the results of this process are not being cached.

Progress of mapping appears in the mini-buffer on Spacemacs startup.

In *messages* buffer on startup the following entries are added

Unicode Fonts - Mapping Unicode Blocks in fontset-default ... done
Unicode Fonts - Mapping Overrides in fontset-default ... done
Unicode Fonts - Mapping Unicode Blocks in fontset-startup ... done
Unicode Fonts - Mapping Overrides in fontset-startup ... done
Unicode Fonts - Mapping Unicode Blocks in fontset-standard ... done
Unicode Fonts - Mapping Overrides in fontset-standard ... done

Reproduction guide :beetle:

     (unicode-fonts :variables
                    unicode-fonts-enable-ligatures t
                    unicode-fonts-ligature-modes '(prog-mode))
   dotspacemacs-default-font '("Fira Code"
                               :size 12.0
                               :weight normal
                               :width normal)

Observed behaviour: :eyes: :broken_heart:

Unicode fonts are mapped each time

Expected behaviour: :heart: :smile:

Unicode font mapping should be saved in the Spacemacs cache, so only runs once (unless font / configuration is changed)

System Info :computer:

Backtrace :paw_prints:

<<BACKTRACE IF RELEVANT>>
practicalli-johnny commented 2 years ago

This issue did not occur on Emacs 27, which I was using up until 21st April. There is a ~/.emacs.d/.cache/pcache/unicode-fonts file from that time with the following header

(pcache-repository "unicode-fonts"
  :file "unicode-fonts"
  :object-name "unicode-fonts"
  :version "27.1/0.5"

So it would seem that this issue affects Emacs versions after 27.1 at some point.

I am using a recent build of Emacs 29 (from Ubuntu Emacs PPA) and no new files are being created in ~/.emacs.d/.cache/pcache/ or in ~/.emacs.d/var/pcache/

Related issues

practicalli-johnny commented 2 years ago

Using Emacs 28.1 on Ubuntu the issue no longer occurs. A new version of the ~/.emacs.d/.cache/unicode-fonts file is created for Emacs version 28.1

(pcache-repository "unicode-fonts"
  :file "unicode-fonts"
  :object-name "unicode-fonts"
  :version "28.1/0.5"

Emacs 28 does not seem to be packaged for Ubuntu, although the steps to build from the Emacs source code are relatively straight forward: https://practical.li/blog/posts/build-emacs-28-on-ubuntu/

LemonBreezes commented 2 years ago

I don't know what's causing this issue but it's occurring in the (cl-call-next-method) call within make-instance. I don't really know much about eieio though. EDIT: I've commented on https://github.com/sigma/pcache/issues/16 as well.

LemonBreezes commented 2 years ago

I have just submitted a pull request fixing this issue: https://github.com/sigma/pcache/pull/17.