Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spacemacs-theme-custom-colors+variable => wrong-type-argument (emacs 26.2) #149

Open
tdd11235813 opened this issue Jul 9, 2019 · 4 comments

Comments

@tdd11235813
Copy link

tdd11235813 commented Jul 9, 2019

As of emacs 26.2 an association list combined with an if-condition fails where the face is defined. The error is:

Debugger entered--Lisp error: (wrong-type-argument stringp (if (eq alternative (quote dark)) "#101010" "#b2b2b2"))
  internal-set-lisp-face-attribute(cursor :background (if (eq alternative (quote dark)) "#101010" "#b2b2b2") #<frame emacs@Mammatus 0x1221c30>)
  set-face-attribute(cursor #<frame emacs@Mammatus 0x1221c30> :background (if (eq alternative (quote dark)) "#101010" "#b2b2b2"))
  apply(set-face-attribute cursor #<frame emacs@Mammatus 0x1221c30> (:background (if (eq alternative (quote dark)) "#101010" "#b2b2b2")))
  face-spec-set-2(cursor #<frame emacs@Mammatus 0x1221c30> (:background (if (eq alternative (quote dark)) "#101010" "#b2b2b2")))
  face-spec-recalc(cursor #<frame emacs@Mammatus 0x1221c30>)
  custom-theme-recalc-face(cursor)
  enable-theme(spacemacs-dark)
  load-theme(spacemacs-dark t)
<snip>

The init.el configuration with spacemacs-common:

(setq debug-on-error t)
(setq alternative 'dark)
(setq spacemacs-theme-custom-colors
        '(
          (cursor . (if (eq alternative 'dark) "#101010" "#b2b2b2"))
          ))
(require 'spacemacs-common)
(load-theme 'spacemacs-dark t)

It seems it just expects a string, because a simple variable will now fail too:

(setq testcolor "#ff0000")
(setq spacemacs-theme-custom-colors
      '(
        (cursor . testcolor)
        ))
;; => wrong-type-argument stringp testcolor

I need the condition expression in the face to interactively switch theme settings. However, I am already trying to find other ways how to overload your theme as part of a new theme without redefining everything (while using heaven-and-hell package for switching). Alas, my lisp skill is close to zero and it seems I have to duplicate code to make it work again (no face-defs with if-conditions).

back to issue: It comes with a change in emacs 26.2 backend (<26.2 worked), but could not find a thing in changelog) and on emacs github (files of face functions have not been touched since 2018).

Update: it is not emacs, but the dyn-let change in spacemacs-common.el from #144

@tdd11235813
Copy link
Author

tdd11235813 commented Jul 9, 2019

Referring to issue #139: The related PR #144 is the issue, because it was working before the change for me.
Additionally, it seems that not every variable becomes overwritten now. For instance, the color for var cannot be overwritten after that change.
I replaced the spacemacs-common.el with the older version, where dyn-let was used.
Here, everything the variable-thing works again. So why the behavior here is the opposite to what @jjzmajic and @noctuid have seen?

PS:

;; just for testing which color is set
(custom-set-variables '(spacemacs-theme-custom-colors
      '(                                             
        (str . "#ff0000")                            
        (act1 . "#ff0000")                           
        (act2 . "#ff0000")                           
        (lnum . "#ff0000")                           
        (highlight . "#ff0000")                      
        (green-bg-s . "#ff0000") ; for lazy highlight
        (bg1 . "#ff0000")                            
        (keyword . "#ff0000")                        
        (const . "#ff0000")                          
        (type . "#ff0000")                           
        (var . "#ff0000")                            
        (func . "#ff0000")                           
        (base . "#ff0000")                           
        (base-dim . "#ff0000")                       
        (comment . "#ff0000")                        
        )))                                          
(load-theme 'spacemacs-dark t)                       

Edit: the dyn-let version still might have issues. When I try to use it within another theme, custom colors are mostly not applied, have to play around later. Btw, versions I compared: spacemacs-theme-20181107.1725 vs spacemacs-theme-20190617.633.

@tdd11235813
Copy link
Author

tdd11235813 commented Jul 10, 2019

I have prepared a minimal example:

git clone --single-branch --branch test-space-theme https://github.com/tdd11235813/emacs_config.git
emacs -l emacs_config/init.el

UPDATE: Do NOT use -l emacs_config/init.el, this messes up emacs init process.

See git log and the commentary in init.el header. There are three four commits. First commit tests just custom theming with spacemacs-theme. Second one tests the variable issue. Third commit tests combination with heaven-and-hell theme switcher (related heaven-and-hell issue).
Fourth commit shows the current solution for heaven-and-hell combination and customized spacemacs-theme as an own theme, wherein setq is used instead of custom-set-variables.

I have also checked a newer dyn-let version, namely spacemacs-theme-20190116.2107, which also showed the same effect.

@tdd11235813
Copy link
Author

I have updated the minimal example branch. The combination with heaven-and-hell is also resolved.
Using variables within is still not possible.

git clone --single-branch --branch test-space-theme https://github.com/tdd11235813/emacs_config.git $HOME/.emacs.d
cd $HOME/.emacs.d
git checkout HEAD~2 # to test the variable issue
emacs # error => set-face-attribute: Wrong type argument: stringp, my-var

@nashamri
Copy link
Owner

Thanks @tdd11235813 for investigate this issue. I'm travelling currently, I'll look into it when I get back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants