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.69k stars 4.9k forks source link

Unicode Package throws Warning and fonts are not loaded #15699

Closed Khoulaiz closed 2 years ago

Khoulaiz commented 2 years ago

Description :octocat:

Unicode Package in Spacemacs causes error in init function and fonts are not loaded correctly.

Reproduction guide :beetle:

     (unicode-fonts :variables unicode-fonts-enable-ligatures t
                    unicode-fonts-force-multi-color-on-mac t
                    unicode-fonts-ligature-modes '(text-mode prog-mode)
                    )
     dotspacemacs-default-font '(
                                 ("MonoLisa"
                                  :size 15.0
                                  :weight normal
                                  :width normal)
                                 ("MonoLisa Script"
                                  :size 15.0
                                  :weight normal
                                  :width normal)
                                 ("Fira Code"
                                 :size 17.0
                                 :weight normal
                                 :width normal)
                                 )

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

System Info :computer:

Backtrace :paw_prints:

Debugger entered--Lisp error: (void-variable unicode-fonts-skip-font-groups)
  (delq 'multi-color unicode-fonts-skip-font-groups)
  (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups))
  (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))
  (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups))))
  (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame)))
  (progn (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook))
  (if (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook)))
  (when (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook))
  (condition-case err (when (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook)) ((debug error) (funcall use-package--warning298 :init err)))
  (condition-case-unless-debug err (when (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook)) (error (funcall use-package--warning298 :init err)))
  (progn (condition-case-unless-debug err (when (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq ... unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook)) (error (funcall use-package--warning298 :init err))) (let ((now (current-time))) (message "%s..." "Loading package unicode-fonts") (prog1 (if (not (require 'unicode-fonts nil t)) (display-warning 'use-package (format "Cannot load %s" 'unicode-fonts) :error) (let ((now (current-time))) (message "%s..." "Configuring package unicode-fonts") (prog1 (condition-case-unless-debug err (progn ... t) (error ...)) (let (...) (if ... ... ...))))) (let ((elapsed (float-time (time-subtract ... now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package unicode-fonts" elapsed) (message "%s...done" "Loading package unicode-fonts"))))))
  (condition-case err (progn (condition-case-unless-debug err (when (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system ...)) (progn (setq unicode-fonts-skip-font-groups ...))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook)) (error (funcall use-package--warning298 :init err))) (let ((now (current-time))) (message "%s..." "Loading package unicode-fonts") (prog1 (if (not (require 'unicode-fonts nil t)) (display-warning 'use-package (format "Cannot load %s" 'unicode-fonts) :error) (let ((now ...)) (message "%s..." "Configuring package unicode-fonts") (prog1 (condition-case-unless-debug err ... ...) (let ... ...)))) (let ((elapsed (float-time ...))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package unicode-fonts" elapsed) (message "%s...done" "Loading package unicode-fonts")))))) ((debug error) (funcall use-package--warning298 :catch err)))
  (condition-case-unless-debug err (progn (condition-case-unless-debug err (when (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system ...)) (progn (setq unicode-fonts-skip-font-groups ...))) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook)) (error (funcall use-package--warning298 :init err))) (let ((now (current-time))) (message "%s..." "Loading package unicode-fonts") (prog1 (if (not (require 'unicode-fonts nil t)) (display-warning 'use-package (format "Cannot load %s" 'unicode-fonts) :error) (let ((now ...)) (message "%s..." "Configuring package unicode-fonts") (prog1 (condition-case-unless-debug err ... ...) (let ... ...)))) (let ((elapsed (float-time ...))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package unicode-fonts" elapsed) (message "%s...done" "Loading package unicode-fonts")))))) (error (funcall use-package--warning298 :catch err)))
  (progn (defvar use-package--warning298 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" ... keyword ...))) (display-warning 'use-package msg :error)))) (condition-case-unless-debug err (progn (condition-case-unless-debug err (when (run-hook-with-args-until-failure 'use-package--unicode-fonts--pre-init-hook) (progn (if (and unicode-fonts-force-multi-color-on-mac ...) (progn ...)) (unicode-fonts//setup-fonts (selected-frame))) (run-hooks 'use-package--unicode-fonts--post-init-hook)) (error (funcall use-package--warning298 :init err))) (let ((now (current-time))) (message "%s..." "Loading package unicode-fonts") (prog1 (if (not (require ... nil t)) (display-warning 'use-package (format "Cannot load %s" ...) :error) (let (...) (message "%s..." "Configuring package unicode-fonts") (prog1 ... ...))) (let ((elapsed ...)) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package unicode-fonts" elapsed) (message "%s...done" "Loading package unicode-fonts")))))) (error (funcall use-package--warning298 :catch err))))
  (use-package unicode-fonts :init (progn (if (and unicode-fonts-force-multi-color-on-mac (eq window-system 'ns)) (progn (setq unicode-fonts-skip-font-groups (delq 'multi-color unicode-fonts-skip-font-groups)))) (unicode-fonts//setup-fonts (selected-frame))))
  unicode-fonts/init-unicode-fonts()
  funcall(unicode-fonts/init-unicode-fonts)
  (let* ((pkg-name (eieio-oref pkg ':name)) (owner (car (eieio-oref pkg ':owners)))) (spacemacs-buffer/message (format "%S -> init (%S)..." pkg-name owner)) (funcall (intern (format "%S/init-%S" owner pkg-name))))
  configuration-layer//configure-package(#<cfgl-package cfgl-package-1fde585bdf1c>)
  mapc(configuration-layer//configure-package (#<cfgl-package cfgl-package-1fde585c9730> #<cfgl-package cfgl-package-1fde585c7e88> #<cfgl-package cfgl-package-1fde585ccb1c> #<cfgl-package cfgl-package-1fde585ccb30> #<cfgl-package cfgl-package-1fde585cab1c> #<cfgl-package cfgl-package-1fde585cd31c> #<cfgl-package cfgl-package-1fde585bf31c> #<cfgl-package cfgl-package-1fde585cd330> #<cfgl-package cfgl-package-1fde585c9754> #<cfgl-package cfgl-package-1fde585c1f54> #<cfgl-package cfgl-package-1fde585c1a88> #<cfgl-package cfgl-package-1fde585c5eac> #<cfgl-package cfgl-package-1fde585c8354> #<cfgl-package cfgl-package-1fde585be2e4> #<cfgl-package cfgl-package-1fde585ccb54> #<cfgl-package cfgl-package-1fde585c8330> #<cfgl-package cfgl-package-1fde585cab30> #<cfgl-package cfgl-package-1fde585bff30> #<cfgl-package cfgl-package-1fde585c9288> #<cfgl-package cfgl-package-1fde585c92ac> #<cfgl-package cfgl-package-1fde585beeac> #<cfgl-package cfgl-package-1fde585bdec0> #<cfgl-package cfgl-package-1fde585cc688> #<cfgl-package cfgl-package-1fde585cab54> #<cfgl-package cfgl-package-1fde585bff54> #<cfgl-package cfgl-package-1fde585c62f8> #<cfgl-package cfgl-package-1fde585caee4> #<cfgl-package cfgl-package-1fde585beac0> #<cfgl-package cfgl-package-1fde585cc6ac> #<cfgl-package cfgl-package-1fde585c6b30> #<cfgl-package cfgl-package-1fde585c92c0> #<cfgl-package cfgl-package-1fde585c6b54> #<cfgl-package cfgl-package-1fde585c2ef8> #<cfgl-package cfgl-package-1fde585c6688> #<cfgl-package cfgl-package-1fde585c2ac0> #<cfgl-package cfgl-package-1fde585c6354> #<cfgl-package cfgl-package-1fde585bfa88> #<cfgl-package cfgl-package-1fde585c5e88> #<cfgl-package cfgl-package-1fde585cd2f8> #<cfgl-package cfgl-package-1fde585c5ec0> #<cfgl-package cfgl-package-1fde585c96ac> #<cfgl-package cfgl-package-1fde585c96c0> #<cfgl-package cfgl-package-1fde585c6ec0> #<cfgl-package cfgl-package-1fde585cd354> #<cfgl-package cfgl-package-1fde585cbf30> #<cfgl-package cfgl-package-1fde585c92f8> #<cfgl-package cfgl-package-1fde585ca688> #<cfgl-package cfgl-package-1fde585c931c> #<cfgl-package cfgl-package-1fde585cce88> #<cfgl-package cfgl-package-1fde585c9354> ...))
  (let (packages-to-configure) (let ((--dolist-tail-- packages)) (while --dolist-tail-- (let ((pkg-name (car --dolist-tail--))) (let ((pkg (configuration-layer/get-package pkg-name))) (cond ((eieio-oref pkg ...) (spacemacs-buffer/message ...)) ((and ... ...) (spacemacs-buffer/message ...)) ((null ...) (spacemacs-buffer/message ...)) ((not ...) (spacemacs-buffer/message ...)) ((not ...) (spacemacs-buffer/message ...)) (t (let ... ...) (if ... nil ...) (cond ... ...)))) (setq --dolist-tail-- (cdr --dolist-tail--))))) (setq packages-to-configure (reverse packages-to-configure)) (mapc 'configuration-layer//configure-package packages-to-configure) (mapc 'configuration-layer//post-configure-package packages-to-configure))
  configuration-layer//configure-packages-2((abbrev ac-ispell ace-link ace-window add-node-modules-path aggressive-indent all-the-icons anaconda-mode ansi-colors archive-mode auctex auctex-latexmk auto-compile auto-complete auto-dictionary auto-highlight-symbol auto-yasnippet avy blacken bookmark buffer-menu cape cargo centaur-tabs centered-cursor-mode clean-aindent-mode code-cells color-identifiers-mode column-enforce-mode comint comment-dwim-2 company-box company-posframe company-quickhelp company-statistics compat compile compleseus-spacemacs-help conf-mode consult consult-dir consult-lsp consult-yasnippet corfu corfu-doc crux css-mode csv-mode cus-edit cython-mode ...))
  configuration-layer//configure-packages((abbrev ac-ispell ace-link ace-window add-node-modules-path aggressive-indent all-the-icons anaconda-mode ansi-colors archive-mode async auctex auctex-latexmk auto-compile auto-complete auto-dictionary auto-highlight-symbol auto-yasnippet avy bind-key bind-map blacken bookmark buffer-menu cape cargo centaur-tabs centered-cursor-mode clean-aindent-mode code-cells color-identifiers-mode column-enforce-mode comint comment-dwim-2 company-box company-posframe company-quickhelp company-statistics compat compile compleseus-spacemacs-help conf-mode consult consult-dir consult-lsp consult-yasnippet corfu corfu-doc crux css-mode ...))
  configuration-layer//load()
  (cond (changed-since-last-dump-p (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message "Layer list has changed since last dump.") (configuration-layer//dump-emacs)))) (spacemacs-force-dump (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "--force-dump passed on the command line or configu..." "been reloaded, forcing a redump.")) (configuration-layer//dump-emacs)))) ((spacemacs-is-dumping-p) (configuration-layer//load)) ((and (spacemacs/emacs-with-pdumper-set-p) (spacemacs-run-from-dump-p)) (configuration-layer/message "Running from a dumped file. Skipping the loading p...")) (t (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "Layer list has not changed since last time. " "Skipping dumping process!"))))))
  configuration-layer/load()
  (let ((file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start)))))
  (if (not (version<= spacemacs-emacs-min-version emacs-version)) (error (concat "Your version of Emacs (%s) is too old. " "Spacemacs requires Emacs version %s or above.") emacs-version spacemacs-emacs-min-version) (let ((file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start))))))
  load-with-code-conversion("/Users/vwh2ipn/.emacs.d/init.el" "/Users/vwh2ipn/.emacs.d/init.el" t t)
  load("/Users/vwh2ipn/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1551cea4b5bd2d>) #f(compiled-function () #<bytecode -0x1f3c6feddc0af235>) t)
  command-line()
  normal-top-level()
Khoulaiz commented 2 years ago

I forgot to mention: My current workaround is to add the following to dotspacemacs/user-config

(unicode-fonts-setup)

After that I of course still have the annoying warning, but the fonts and ligatures are working as expected.

lebensterben commented 2 years ago

does checking out https://github.com/syl20bnr/spacemacs/commit/9010d8d3cae530b5a29e6b34883f860d411088d0 fix it?

Khoulaiz commented 2 years ago

does checking out https://github.com/syl20bnr/spacemacs/commit/9010d8d3cae530b5a29e6b34883f860d411088d0 fix it?

No, but I guess that's the wrong commit. I am already on develop btw.

The commit that breaks it is the recent unicode change 4f6413e82ff9778e7ac1e85ece6b3218f0c888e4

lebensterben commented 2 years ago

@Khoulaiz

If https://github.com/syl20bnr/spacemacs/commit/4f6413e82ff9778e7ac1e85ece6b3218f0c888e4 breaks it as you said, then https://github.com/syl20bnr/spacemacs/commit/9010d8d3cae530b5a29e6b34883f860d411088d0 certainly should fix it, because that's before the changes made to unicode-fonts layer.

lebensterben commented 2 years ago

@Khoulaiz

What if you change this line https://github.com/syl20bnr/spacemacs/blob/c5c69ce239577ce1e0fb468698d7aeb2453a6cbb/layers/%2Bfonts/unicode-fonts/packages.el#L41 to

              '(decorative low-quality-glyphs)))
Khoulaiz commented 2 years ago

| If https://github.com/syl20bnr/spacemacs/commit/4f6413e82ff9778e7ac1e85ece6b3218f0c888e4 breaks it as you said, then https://github.com/syl20bnr/spacemacs/commit/9010d8d3cae530b5a29e6b34883f860d411088d0 certainly should fix it, because that's before the changes made to unicode-fonts layer.

Ahh, you meant going back to that commit. Yes, everything works fine up to the breaking commit.

Khoulaiz commented 2 years ago

What if you change this line

https://github.com/syl20bnr/spacemacs/blob/c5c69ce239577ce1e0fb468698d7aeb2453a6cbb/layers/%2Bfonts/unicode-fonts/packages.el#L41

to

              '(decorative low-quality-glyphs)))

That did the trick for me. No warning anymore and ligatures are working without my workaround from above.

BTW: my settings are

    dotspacemacs-enable-server t
    dotspacemacs-persistent-server nil
lebensterben commented 2 years ago

I will push the fix (along with a few other small changes) after I finished my work at hand. (Hopefully this week)

Khoulaiz commented 2 years ago

any update for this issue? I still have the problem with the newest version

lebensterben commented 2 years ago

I've not got time. PR is welcomed.

Khoulaiz commented 2 years ago

You want a PR for the one-line fix you already suggested above? I can do that if you want, but you wanted to add some more unicode related stuff as well. I can't deliver that, though

Fabbi commented 2 years ago

for me it shows Error (use-package): unicode-fonts/:init: Symbol’s value as variable is void: \.\.\. I had to manually add lines with the corresponding variables in the function to even get the names to show up in the warning..

after applying the lines from @lebensterben it still shows this message.. Looks like unicode-fonts//setup-fonts is void, too, which is super weird..

Any idea on why this is happening?

(I'm on the latest dev commit and all updated packages with emacs 28.2)