protesilaos / modus-themes

Highly accessible themes for GNU Emacs, conforming with the highest standard for colour contrast between background and foreground values (WCAG AAA).
https://protesilaos.com/emacs/modus-themes
GNU General Public License v3.0
553 stars 30 forks source link

"custom-theme-set-faces: Variable binding depth exceeds max-specpdl-size" after upgrading to modus-themes #65

Open jjnilton opened 1 year ago

jjnilton commented 1 year ago

After upgrading modus-themes to s modus-themes 20230120.926 I get this error message:

custom-theme-set-faces: Variable binding depth exceeds max-specpdl-size

Emacs also freezes when setting the theme and at startup if any of the modus-themes are the default.

I'm on Emacs 27.1.

protesilaos commented 1 year ago

Hello @jjnilton! Do you know which version you were using before this last update? It will help me trace the root of the problem.

jjnilton commented 1 year ago

I'm not entirely sure, but from what I can see in another Emacs installation I have, it is probably: modus-themes 20221129.211.

I installed a newer Emacs just to test, and the issue does not seem to be present in Emacs 29.0.60.

protesilaos commented 1 year ago

I see. I suspect the issue will go away if you delete the package and install it again. The reason is that I made a big update on the 1st January 2023. The release notes cover all the breaking changes: https://protesilaos.com/codelog/2023-01-01-modus-themes-4-0-0/

jjnilton commented 1 year ago

Deleting and reinstalling the version 20230120.926 does not seem to fix the issue, but installing the 3.0.0 version from gnu works without issues:

The version that works without issues:

Version: 3.0.0
Commit: 1e7710d00f909900c9934d61113c43cb2229530f

The problem is that if I try to upgrade my packages using list-packages, it tries to upgrade using melpa and then it breaks again.

protesilaos commented 1 year ago

I see. Can you share with me the package configuration you have? I suspect this is a case with modus-themes-with-colors.

jjnilton commented 1 year ago

Lines of my config related to modus-themes:

41 matches in 12 lines for "modus" in buffer: init.el
    387: '(custom-enabled-themes '(modus-operandi))
    403: '(flymake-error-bitmap '(flymake-double-exclamation-mark modus-themes-fringe-red))
    404: '(flymake-note-bitmap '(exclamation-mark modus-themes-fringe-cyan))
    405: '(flymake-warning-bitmap '(exclamation-mark modus-themes-fringe-yellow))
    436: '(ibuffer-deletion-face 'modus-themes-mark-del)
    437: '(ibuffer-filter-group-name-face 'modus-themes-pseudo-header)
    438: '(ibuffer-marked-face 'modus-themes-mark-sel)
    480: '(modus-themes-org-blocks 'grayscale)
    508:   '(modus-themes magit restclient ox-gfm counsel-jq flycheck-plantuml plantuml-mode csv-mode feature-mode dockerfile-mode yasnippet ob-php git-link ledger-mode php-mode ivy-rich ibuffer-projectile highlight-indent-guides rainbow-delimiters lsp-pyright rg frameshot path-headerline-mode gif-screencast company-quickhelp keycast tramp flycheck lsp-ui diff-hl multiple-cursors idle-highlight-mode company projectile counsel ivy web-mode windsize which-key uniquify-files undo-tree transpose-frame smex emmet-mode crux))
    515:   '(modus-themes-fg-red modus-themes-fg-green modus-themes-fg-blue modus-themes-fg-yellow modus-themes-fg-magenta modus-themes-fg-cyan modus-themes-fg-red-warmer modus-themes-fg-green-warmer modus-themes-fg-blue-warmer modus-themes-fg-yellow-warmer modus-themes-fg-magenta-warmer modus-themes-fg-cyan-warmer modus-themes-fg-red-cooler modus-themes-fg-green-cooler modus-themes-fg-blue-cooler modus-themes-fg-yellow-cooler modus-themes-fg-magenta-cooler modus-themes-fg-cyan-cooler modus-themes-fg-red-faint modus-themes-fg-green-faint modus-themes-fg-blue-faint modus-themes-fg-yellow-faint modus-themes-fg-magenta-faint modus-themes-fg-cyan-faint modus-themes-fg-red-intense modus-themes-fg-green-intense modus-themes-fg-blue-intense modus-themes-fg-yellow-intense modus-themes-fg-magenta-intense modus-themes-fg-cyan-intense))
    600: '(tab-bar-tab ((t (:inherit modus-themes-tab-active :background "white" :foreground "black" :box (:line-width 2 :color "white")))))
    601: '(tab-bar-tab-inactive ((t (:inherit modus-themes-tab-inactive :distant-foreground "gainsboro" :foreground "gray20" :box (:line-width 2 :color "gray25"))))))

My whole config is here if needed: https://github.com/jjnilton/.emacs.d/blob/temp/init.el (warning: it's very messy)

protesilaos commented 1 year ago

I visited your config and copied the lines between 348 and 579. I reviewed them, but did not notice anything suspicious. There are some faces that are obsolete though and should be removed. Still, this is not the cause of the problem.

I launched Emacs in a pristine environment by using emacs -Q on the command line. In the scratch buffer of the new Emacs, I added the contents of your configuration. Then I did M-x eval-buffer: everything worked as expected. Screenshots that show what I describe:

2023-01-21_17:17:21_1273x1054

2023-01-21_17:17:32_1273x1054

2023-01-21_17:17:38_1273x1054

Obsolete faces

These lines should not affect you, but it is better to remove them as they are no longer relevant:

'(flymake-error-bitmap '(flymake-double-exclamation-mark modus-themes-fringe-red))
'(flymake-note-bitmap '(exclamation-mark modus-themes-fringe-cyan))
'(flymake-warning-bitmap '(exclamation-mark modus-themes-fringe-yellow))
'(ibuffer-filter-group-name-face 'modus-themes-pseudo-header)
'(tab-bar-tab ((t (:inherit modus-themes-tab-active :background "white" :foreground "black" :box (:line-width 2 :color "white")))))
'(tab-bar-tab-inactive ((t (:inherit modus-themes-tab-inactive :distant-foreground "gainsboro" :foreground "gray20" :box (:line-width 2 :color "gray25")))))

For your convenience, I copy your config within the lines I originally mentioned with those obsolete faces omitted:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default bold shadow italic underline success warning error])
 '(ansi-color-names-vector
   ["gray35" "#ff8059" "#44bc44" "#d0bc00" "#2fafff" "#feacd0" "#00d3d0" "gray65"])
 '(auto-save-file-name-transforms '((".*" "~/.emacs.d/backup/" t)))
 '(awesome-tray-mode-line-active-color "#2fafff")
 '(awesome-tray-mode-line-inactive-color "#323232")
 '(backup-directory-alist '(("." . "~/.emacs.d/backup/")))
 '(chart-face-color-list
   '("#ef7969" "#4faa09" "#ffcf00" "#7090ff" "#e07fff" "#70d3f0" "#ffaab4" "#8fef00" "#f9ff00" "#9fc6ff" "#fad0ff" "#afefff"))
 '(column-number-mode t)
 '(company-dabbrev-downcase nil)
 '(current-language-environment "UTF-8")
 '(custom-enabled-themes '(modus-operandi))
 '(custom-safe-themes
   '("71ac1434a07579da9b1ec1dd1a2b9cfa3182523d750678b68db6c25749fb6494" "3adebe6a07e999ecadabd1a12eb8becf0e036172cde1807b25b9a5919046339c" "1fab98300b100a19010734a14c4bf9b6712ffc8b9e1d7eca35f837adeeabf740" "53585ce64a33d02c31284cd7c2a624f379d232b27c4c56c6d822eff5d3ba7625" "7dc296b80df1b29bfc4062d1a66ee91efb462d6a7a934955e94e786394d80b71" "3199be8536de4a8300eaf9ce6d864a35aa802088c0925e944e2b74a574c68fd0" "3860a842e0bf585df9e5785e06d600a86e8b605e5cc0b74320dfe667bcbe816c" "ab04c00a7e48ad784b52f34aa6bfa1e80d0c3fcacc50e1189af3651013eb0d58" "04dd0236a367865e591927a3810f178e8d33c372ad5bfef48b5ce90d4b476481" "7356632cebc6a11a87bc5fcffaa49bae528026a78637acd03cae57c091afd9b9" "74a50f18c8c88eac44dc73d7a4c0bbe1f3e72ff5971aac38fcf354ddad0d4733" "aa72e5b41780bfff2ff55d0cc6fcd4b42153386088a4025fed606c1099c2d9b8" default))
 '(diff-hl-flydiff-mode t)
 '(dired-listing-switches "-alh")
 '(dired-mode-hook '(auto-revert-mode diff-hl-dired-mode))
 '(ediff-split-window-function 'split-window-horizontally)
 '(ediff-window-setup-function 'ediff-setup-windows-plain)
 '(electric-pair-pairs '((34 . 34) (8216 . 8217) (8220 . 8221) (39 . 39)))
 '(electric-pair-text-pairs '((34 . 34) (8216 . 8217) (8220 . 8221) (39 . 39)))
 '(erc-server "irc.libera.chat")
 '(eval-expression-print-length nil)
 '(eval-expression-print-level nil)
 '(explicit-shell-file-name "/bin/bash")
 '(exwm-floating-border-color "#646464")
 '(fci-rule-color "#5B6268")
 '(global-diff-hl-mode t)
 '(global-hl-line-mode t)
 '(global-undo-tree-mode t)
 '(global-whitespace-mode nil)
 '(highlight-changes-colors nil)
 '(highlight-changes-face-list '(success warning error bold bold-italic))
 '(highlight-tail-colors
   ((("#101909" "#A8FF60" "green")
     . 0)
    (("#131319" "#C6C5FE" "brightcyan")
     . 20)))
 '(hl-todo-keyword-faces
   '(("HOLD" . "#c0c530")
     ("TODO" . "#feacd0")
     ("NEXT" . "#b6a0ff")
     ("THEM" . "#f78fe7")
     ("PROG" . "#00d3d0")
     ("OKAY" . "#4ae2f0")
     ("DONT" . "#70b900")
     ("FAIL" . "#ff8059")
     ("BUG" . "#ff8059")
     ("DONE" . "#44bc44")
     ("NOTE" . "#d3b55f")
     ("KLUDGE" . "#d0bc00")
     ("HACK" . "#d0bc00")
     ("TEMP" . "#ffcccc")
     ("FIXME" . "#ff9077")
     ("XXX+" . "#ef8b50")
     ("REVIEW" . "#6ae4b9")
     ("DEPRECATED" . "#bfd9ff")))
 '(ibuffer-deletion-face 'modus-themes-mark-del)
 '(ibuffer-marked-face 'modus-themes-mark-sel)
 '(ibuffer-title-face 'default)
 '(indent-guide-char "│")
 '(indent-guide-recursive t)
 '(isearch-lazy-count t)
 '(ispell-dictionary "pt_BR")
 '(ispell-skip-html t)
 '(ivy-mode t)
 '(ivy-pre-prompt-function 'ivy-curr-reb)
 '(ivy-preferred-re-builders
   '((ivy--regex-plus . "regex")
     (ivy--regex-ignore-order . "order")
     (ivy--regex-fuzzy . "fuzzy")))
 '(ivy-read-action-format-function 'ivy-read-action-format-columns)
 '(ivy-rich-mode t)
 '(ivy-use-selectable-prompt t)
 '(ivy-virtual-abbreviate 'abbreviate)
 '(jdee-db-active-breakpoint-face-colors (cons "#1B2229" "#96CBFE"))
 '(jdee-db-requested-breakpoint-face-colors (cons "#1B2229" "#A8FF60"))
 '(jdee-db-spec-breakpoint-face-colors (cons "#1B2229" "#3f444a"))
 '(keycast-mode-line-format "%1s%k%c%r")
 '(keycast-mode-line-remove-tail-elements nil)
 '(ledger-reports
   '(("budget" "%(binary) -f %(ledger-file) --budget --monthly reg expenses")
     ("bal" "%(binary) -f %(ledger-file) bal")
     ("reg" "%(binary) -f %(ledger-file) reg")
     ("payee" "%(binary) -f %(ledger-file) reg @%(payee)")
     ("account" "%(binary) -f %(ledger-file) reg %(account)")))
 '(lsp-disabled-clients '(eslint))
 '(lsp-file-watch-threshold 10000)
 '(magit-uniquify-buffer-names nil)
 '(mini-modeline-face-attr '(:background unspecified))
 '(minimap-hide-fringes t)
 '(minimap-mode t)
 '(mlr-non-rectangle-style 'lines+words+chars)
 '(mode-line-format
   '("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification "   " mode-line-position
     (vc-mode
      (:eval
       (format "%s@%s" vc-mode
               (projectile-project-name))))
     "  " mode-line-modes mode-line-misc-info mode-line-end-spaces))
 '(modus-themes-org-blocks 'grayscale)
 '(objed-cursor-color "#ff6c60")
 '(org-babel-load-languages '((emacs-lisp . t) (python . t) (js . t)))
 '(org-fontify-quote-and-verse-blocks t)
 '(org-habit-graph-column 60)
 '(org-log-into-drawer t)
 '(org-modules
   '(ol-bbdb ol-bibtex ol-docview ol-eww ol-gnus org-habit ol-info ol-irc ol-mhe ol-rmail ol-w3m))
 '(org-src-block-faces 'nil)
 '(org-src-lang-modes
   '(("php" . php)
     ("C" . c)
     ("C++" . c++)
     ("asymptote" . asy)
     ("bash" . sh)
     ("beamer" . latex)
     ("calc" . fundamental)
     ("cpp" . c++)
     ("ditaa" . artist)
     ("dot" . fundamental)
     ("elisp" . emacs-lisp)
     ("ocaml" . tuareg)
     ("screen" . shell-script)
     ("shell" . sh)
     ("sqlite" . sql)
     ("plantuml" . plantuml)))
 '(package-selected-packages
   '(modus-themes magit restclient ox-gfm counsel-jq flycheck-plantuml plantuml-mode csv-mode feature-mode dockerfile-mode yasnippet ob-php git-link ledger-mode php-mode ivy-rich ibuffer-projectile highlight-indent-guides rainbow-delimiters lsp-pyright rg frameshot path-headerline-mode gif-screencast company-quickhelp keycast tramp flycheck lsp-ui diff-hl multiple-cursors idle-highlight-mode company projectile counsel ivy web-mode windsize which-key uniquify-files undo-tree transpose-frame smex emmet-mode crux))
 '(pdf-view-midnight-colors '("#ffffff" . "#100f10"))
 '(php-mode-coding-style 'symfony2)
 '(projectile-globally-ignored-directories
   '("^\\.idea$" "^\\.vscode$" "^\\.ensime_cache$" "^\\.eunit$" "^\\.git$" "^\\.hg$" "^\\.fslckout$" "^_FOSSIL_$" "^\\.bzr$" "^_darcs$" "^\\.pijul$" "^\\.tox$" "^\\.svn$" "^\\.stack-work$" "^\\.ccls-cache$" "^\\.cache$" "^\\.clangd$" ".expo/web/cache/.*" "^\\.log" "^node_modules$"))
 '(projectile-mode t nil (projectile))
 '(rcirc-colors
   '(modus-themes-fg-red modus-themes-fg-green modus-themes-fg-blue modus-themes-fg-yellow modus-themes-fg-magenta modus-themes-fg-cyan modus-themes-fg-red-warmer modus-themes-fg-green-warmer modus-themes-fg-blue-warmer modus-themes-fg-yellow-warmer modus-themes-fg-magenta-warmer modus-themes-fg-cyan-warmer modus-themes-fg-red-cooler modus-themes-fg-green-cooler modus-themes-fg-blue-cooler modus-themes-fg-yellow-cooler modus-themes-fg-magenta-cooler modus-themes-fg-cyan-cooler modus-themes-fg-red-faint modus-themes-fg-green-faint modus-themes-fg-blue-faint modus-themes-fg-yellow-faint modus-themes-fg-magenta-faint modus-themes-fg-cyan-faint modus-themes-fg-red-intense modus-themes-fg-green-intense modus-themes-fg-blue-intense modus-themes-fg-yellow-intense modus-themes-fg-magenta-intense modus-themes-fg-cyan-intense))
 '(reb-re-syntax 'string)
 '(recentf-max-saved-items 40)
 '(recentf-mode t)
 '(rg-command-line-flags '("-C 5"))
 '(rustic-ansi-faces
   ["#000000" "#ff6c60" "#A8FF60" "#FFFFB6" "#96CBFE" "#FF73FD" "#C6C5FE" "#f6f3e8"])
 '(show-paren-mode t)
 '(show-paren-when-point-in-periphery t)
 '(show-paren-when-point-inside-paren t)
 '(size-indication-mode t)
 '(split-width-threshold 140)
 '(tab-bar-close-button-show nil)
 '(tab-bar-mode t)
 '(tab-bar-new-button-show nil)
 '(tab-bar-separator "​" t)
 '(tab-bar-tab-name-function 'tab-bar-tab-name-current-with-count)
 '(text-mode-hook '(turn-on-flyspell text-mode-hook-identify))
 '(tool-bar-mode nil)
 '(truncate-lines t)
 '(undo-tree-enable-undo-in-region nil)
 '(undo-tree-history-directory-alist '(("." . "~/.emacs.d/backup")))
 '(undo-tree-visualizer-diff t)
 '(uniquify-buffer-name-style 'forward nil (uniquify))
 '(vc-annotate-background nil)
 '(vc-annotate-background-mode nil)
 '(vc-annotate-color-map
   '((20 . "#ff8059")
     (40 . "#feacd0")
     (60 . "#f78fe7")
     (80 . "#ef8b50")
     (100 . "#d0bc00")
     (120 . "#c0c530")
     (140 . "#f8dec0")
     (160 . "#bfebe0")
     (180 . "#44bc44")
     (200 . "#70b900")
     (220 . "#6ae4b9")
     (240 . "#4ae2f0")
     (260 . "#00d3d0")
     (280 . "#c6eaff")
     (300 . "#2fafff")
     (320 . "#79a8ff")
     (340 . "#00bcff")
     (360 . "#b6a0ff")))
 '(vc-annotate-very-old-color nil)
 '(visible-bell t)
 '(web-mode-enable-auto-indentation nil)
 '(web-mode-enable-auto-pairing nil)
 '(web-mode-enable-current-element-highlight t)
 '(web-mode-enable-sql-detection t)
 '(web-mode-script-padding 4)
 '(web-mode-style-padding 4)
 '(which-key-mode t)
 '(whitespace-style
   '(face trailing tabs spaces newline empty indentation space-after-tab space-before-tab space-mark tab-mark))
 '(whitespace-trailing-regexp "\\([   ]+$\\|[^ 
]  +[^ 
]\\|^[
]+$\\)")
 '(widget-link-prefix "[")
 '(widget-link-suffix "]")
 '(widget-mouse-face '(highlight widget-button))
 '(widget-push-button-prefix "[")
 '(widget-push-button-suffix "]")
 '(xterm-color-names
   ["black" "#ff8059" "#44bc44" "#d0bc00" "#2fafff" "#feacd0" "#00d3d0" "gray65"])
 '(xterm-color-names-bright
   ["gray35" "#ef8b50" "#70b900" "#c0c530" "#79a8ff" "#f78fe7" "#4ae2f0" "white"]))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight normal :height 120 :width normal))))
 '(keycast-command ((t (:inherit bold :foreground "red"))))
 '(keycast-key ((t (:background "red" :foreground "white" :box (:line-width 1 :color "dark gray")))))
 '(mode-line ((t (:background "#000000" :foreground "#ffffff"))))
 '(mode-line-buffer-id ((t (:inherit bold :background "gray20" :foreground "gray" :weight normal))))
 '(mode-line-buffer-id-highlight ((t (:background "white" :foreground "black" :weight normal))))
 '(mode-line-highlight ((t (:background "white" :foreground "black" :box nil))))
 '(mode-line-id-inactive ((t (:background "gray10" :foreground "dim gray"))))
 '(mode-line-inactive ((t (:background "black" :foreground "gray65" :box (:line-width 1 :color "gray40")))))
 '(tab-bar ((t (:inherit variable-pitch :background "black" :foreground "white")))))
jjnilton commented 1 year ago

Thanks, @protesilaos!

Just for reference, in case it could say something about the issue - I tried one last time to install the most recent version from MELPA (upgrading from 3.0.0 from gnu), and I got this when clicking "Install":

Compiling file /home/jj/.emacs.d/elpa/modus-themes-20230120.926/modus-operandi-deuteranopia-theme.el at Sat Jan 21 13:48:23 2023
Entering directory ‘/home/jj/.emacs.d/elpa/modus-themes-20230120.926/’
modus-operandi-deuteranopia-theme.el:38:1:Error: Wrong number of arguments: (1 . 1), 3

Compiling file /home/jj/.emacs.d/elpa/modus-themes-20230120.926/modus-operandi-theme.el at Sat Jan 21 13:48:23 2023
modus-operandi-theme.el:38:1:Error: Wrong number of arguments: (1 . 1), 3

Compiling file /home/jj/.emacs.d/elpa/modus-themes-20230120.926/modus-operandi-tinted-theme.el at Sat Jan 21 13:48:23 2023
modus-operandi-tinted-theme.el:37:1:Error: Wrong number of arguments: (1 . 1), 3

Compiling file /home/jj/.emacs.d/elpa/modus-themes-20230120.926/modus-themes.el at Sat Jan 21 13:48:23 2023

In modus-themes--prompt:
modus-themes.el:1321:8:Warning: function modus-themes--prompt used to take 8
    arguments, now takes 2

In modus-themes--heading:
modus-themes.el:1359:8:Warning: function modus-themes--heading used to take 6
    arguments, now takes 2-4

In modus-themes--org-block:
modus-themes.el:1385:8:Warning: function modus-themes--org-block used to take
    2-3 arguments, now takes 2

In modus-themes--completion-line:
modus-themes.el:1395:8:Warning: function modus-themes--completion-line used to
    take 5-7 arguments, now takes 1

In modus-themes--completion-match:
modus-themes.el:1418:8:Warning: function modus-themes--completion-match used
    to take 5 arguments, now takes 2

In modus-themes-theme:
modus-themes.el:3880:11:Warning: macro modus-themes-theme used to take 1
    argument, now takes 2-3

Compiling file /home/jj/.emacs.d/elpa/modus-themes-20230120.926/modus-vivendi-deuteranopia-theme.el at Sat Jan 21 13:48:23 2023
modus-vivendi-deuteranopia-theme.el:37:1:Error: Wrong number of arguments: (1 . 1), 3

Compiling file /home/jj/.emacs.d/elpa/modus-themes-20230120.926/modus-vivendi-theme.el at Sat Jan 21 13:48:23 2023
modus-vivendi-theme.el:37:1:Error: Wrong number of arguments: (1 . 1), 3

Compiling file /home/jj/.emacs.d/elpa/modus-themes-20230120.926/modus-vivendi-tinted-theme.el at Sat Jan 21 13:48:23 2023
modus-vivendi-tinted-theme.el:37:1:Error: Wrong number of arguments: (1 . 1), 3

But I don't want to bother you any further, since it's working well with the modus-themes 3.0.0 from gnu repository, and I could upgrade to a newer version of Emacs by building from source (or when Debian releases it) to use the upgraded version of modus-themes. So, feel free to close this issue.

Anyway, thanks again for all the help! And for sharing these themes (and your content - thanks to that, I'm no longer an Emacs tourist).

protesilaos commented 1 year ago

Hi @jjnilton!

Based on the error messages, it seems that some old byte code (.elc file extension) lingers around. This old code gets evaluated with parts of the new code. The result is a mismatch of versions/expectations, hence all the errors.

This is why I originally suggested to delete the package and then try to install it again. What is troubling though, is that you did that but the problem persists... I say we keep this issue open until we find an explanation for the unexpected behaviour.