use-package icon indicating copy to clipboard operation
use-package copied to clipboard

New error with interaction between `use-package` and `gruvbox-theme`

Open Remillard opened this issue 2 years ago • 4 comments

I'm running into a problem that I've got on one laptop but haven't had on any other installation. I cannot figure out what's going on. In my init.el file I have:

(use-package  gruvbox-theme
    :config
    (load-theme 'gruvbox-dark-hard t nil))

(Note, this was formerly just t and not t nil for the optional args to load-theme but I've been experimenting.) In any event, I then get the following message on loading emacs 28:

Error (use-package) : gruvbox-theme/:catch: Symbol's value as variable is void: gruvbox-accent-00

If I subsequently just M-x load-theme gruvbox-dark-hard it works just fine (or if initiated via the Menu Color Themes.)

If I use the package tool to delete the installation and just manually load from ELPA et al, it'll do that fine. If I subsequently do a (load-theme 'gruvbox-dark-hard t) it'll work fine. It's entirely the use-package invocation.

Additionally after puzzling over this over in the gruvbox theme repository, I looked through their code and I can find no reason why it ought to be throwing a void variable catch on that particular variable. It's just one out of about a hundred or more theming color assignments. It's not even used very often, just for some gnus face assignments. So it's definitely a strange case.

Any ideas why this is getting caught and recently? Prior machines had zero problems with that invocation I listed above, however this laptop is new to me since two days ago and so I was going through the usual setup where I get my init.el from my repository and it freshly downloaded all the various packages.

Remillard avatar Aug 06 '22 03:08 Remillard

I am also having this issue. I tried to follow this example: https://emacs.stackexchange.com/questions/28835/setting-up-a-theme-using-use-package, but that didn't work.

It seems either specific to gruvbox or use-package is handling gruvbox in a different way?

I tried zenburn with

(use-package zenburn-theme
  :config
  (load-theme 'zenburn t))

and it loaded fine.

whompyjaw avatar Aug 06 '22 17:08 whompyjaw

I think this is actually a combination of issues between gruvbox and use-package. As @Remillard shows, loading gruvbox through use-package produces the error. However, you can also replicate this error without use-package, simply by using the installation instructions gruvbox provides, https://github.com/greduan/emacs-theme-gruvbox#no-packageel

  1. M-x package-install <return> gruvbox-theme
  2. M-x load-theme <return> gruvbox

On the other hand, if you load a specific theme, e.g. M-x load-theme <return> gruvbox-dark-soft, there's no error. So while there is definitely a bug on gruvbox's side, I'm wondering whether there's something use-package is doing when loading gruvbox that is triggering the same as M-x load-theme <return> gruvbox does.

josherrickson avatar Aug 06 '22 17:08 josherrickson

@saltsucker I can do a similar successful invocation with vscode-dark-plus-theme. It also works fine and just as before.

I looked through gruvbox's timeline and the variable use-package catches as void (gruvbox-accent-00) was added on 8/3, so that tracks with it not affecting older installations and showing up on the laptop installation I was doing the latter part of this week. At the same time, I do not think it's gruvbox's issue as that variable is declared in each of the theme packages identically to a host of others (it's a big theme!)

I have this insane idea it has something to do with the fact the variable is suffixed in -## but only because that pattern does not show up in any of the other gruvbox variables. I don't honestly think that could be it, but my mind is looking for variances to hang a hat on and investigate.

Remillard avatar Aug 06 '22 19:08 Remillard

gruvbox has addressed the issue - https://github.com/greduan/emacs-theme-gruvbox/issues/192#issuecomment-1207629588 With version gruvbox-theme-20220808.302, I now can load it without error via use-package.

josherrickson avatar Aug 08 '22 09:08 josherrickson

It seems like this was already fixed in the gruvbox package, so I'm closing this issue. Please report back if there is more to do here, and we can reopen.

Thanks.

skangas avatar Nov 27 '22 16:11 skangas