Can't load prism.el

What happened?

Running emacs --fg-daemon --debug-init with the following code in my configuration fails.

config.el:

(use-package! prism
  :after modus-themes
  :config
  (setq prism-comments nil)
  (setq prism-num-faces 16)
  (prism-set-colors
      :desaturations '(0) ; do not change---may lower the contrast ratio
      :lightens '(0)      ; same
      :colors (modus-themes-with-colors
                (list fg-main
                      magenta
                      cyan-alt-other
                      magenta-alt-other
                      blue
                      magenta-alt
                      cyan-alt
                      red-alt-other
                      green
                      fg-main
                      cyan
                      yellow
                      blue-alt
                      red-alt
                      green-alt-other
                      fg-special-warm)))
    :hook prog-mode)

packages.el:

(package! prism)

Output of emacs --fg-daemon --debug-init:

Debugger entered--Lisp error: (wrong-number-of-arguments #<subr color-rgb-to-hsl> 0)
  color-rgb-to-hsl()
  color-saturate-name(nil -40)
  color-desaturate-name(nil 40)
  #f(compiled-function (color desaturate lighten) #<bytecode -0x160820bef0815566>)(nil 40 0)
  prism-modify-colors(:num 16 :desaturations (40 50 60) :lightens (0 5 10) :colors nil)
  prism-set-colors()
  prism-customize-set(prism-colors (font-lock-type-face font-lock-function-name-face font-lock-keyword-face font-lock-doc-face))
  custom-initialize-reset(prism-colors (funcall #'#f(compiled-function () #<bytecode -0x6f0fa615dce66b0>)))
  custom-declare-variable(prism-colors (funcall #'#f(compiled-function () #<bytecode -0x6f0fa615dce66b0>)) "List of colors used by default." :type (repeat (choice (face :tag "Face (using its foreground color)") color (list :tag "Doom/Solarized theme color (requires active theme)" (const themed) (string :tag "Color name")) (function :tag "Function which returns a color"))) :set prism-customize-set)
  byte-code("\300\301\302\303\304\305\306\307&\7\210\310\311\312\313\314DD\315\316\317\320\321&\7\210\310\322\312\313\323DD\324\316\325\320\321&\7\210\310\326\312\313\327DD\330\316..." [custom-declare-group prism nil "Disperse lisp forms into a spectrum of colors acco..." :group font-lock :link (url-link "https://github.com/alphapapa/prism.el") custom-declare-variable prism-num-faces funcall function #f(compiled-function () #<bytecode 0x1f400016f2a14>) "Number of `prism' faces." :type integer :set prism-customize-set prism-color-attribute #f(compiled-function () #<bytecode 0x1f4000163c214>) "Face attribute set in `prism' faces." (choice (const :tag "Foreground" :foreground) (const :tag "Background" :background)) prism-desaturations #f(compiled-function () #<bytecode 0x1f40001044a54>) "Default desaturation percentages applied to colors..." (repeat number) prism-lightens #f(compiled-function () #<bytecode 0x1f400016f01d4>) "Default lightening percentages applied to colors a..." (repeat number) prism-comments #f(compiled-function () #<bytecode 0x1f400016fe5d4>) "Whether to colorize comments.\nNote that comments a..." boolean prism-comments-fn #f(compiled-function () #<bytecode -0x1415f4493f8f40e6>) "Function which adjusts colors for comments.\nReceiv..." prism-strings #f(compiled-function () #<bytecode 0x1f400016fe5d4>) "Whether to fontify strings." prism-strings-fn #f(compiled-function () #<bytecode -0x75ffb8c310dc122>) "Function which adjusts colors for strings.\nReceive..." prism-parens #f(compiled-function () #<bytecode 0x1f400016fe914>) "Whether to colorize parens separately.\nWhen disabl..." prism-colors #f(compiled-function () #<bytecode -0x6f0fa615dce66b0>) "List of colors used by default." (repeat (choice (face :tag "Face (using its foreground color)") color (list :tag "Doom/Solarized theme color (requires active theme)" (const themed) (string :tag "Color name")) (function :tag "Function which returns a color"))) ...] 8)
  prism()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook lisp-data-mode-hook emacs-lisp-mode-hook lisp-interaction-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook lisp-data-mode-hook emacs-lisp-mode-hook lisp-interaction-mode-hook))
  run-mode-hooks(lisp-interaction-mode-hook)
  lisp-interaction-mode()
  command-line()
  normal-top-level()

What did you expect to happen?

The Emacs daemon should load without errors.

Steps to reproduce

  1. Install the prism package.
  2. Configure it with the aforementioned (use-package!) block.
  3. Run emacs --fg-daemon --debug-init.

System information


Loading data dump...

doom doctor reports Everything seems fine, happy Emacs'ing! .

Thanks!

PS: I cannot reproduce this issue in vanilla Emacs.

I’ve “solved” this with the following hack:

(use-package! prism
  :commands prism-mode
  :init
  (defun ev/prism-add-prog-mode-hook ()
    "Add `prism-mode' to `prog-mode-hook'."
    (add-hook! 'prog-mode-hook 'prism-mode))
  (add-hook! 'doom-init-ui-hook 'ev/prism-add-prog-mode-hook)
  :config
  (after! modus-themes
    ;; From modus-themes manual.
    (setq prism-num-faces 16)
    (prism-set-colors
     :desaturations '(0) ; do not change---may lower the contrast ratio
     :lightens '(0)      ; same
     :colors (modus-themes-with-colors
               (list fg-main
                     magenta
                     cyan-cooler
                     magenta-cooler
                     blue
                     magenta-warmer
                     cyan-warmer
                     red-cooler
                     green
                     fg-main
                     cyan
                     yellow
                     blue-warmer
                     red-warmer
                     green-cooler
                     yellow-faint)))))

However, I’d be very grateful if anyone could help me pinpoint what is going wrong. Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.