I traced the culprit down to this line:
|
(not (custom-theme-p current-theme)))) |
Change (not (custom-theme-p current-theme)) to (custom-theme-p current-theme) and it works fine.
I don't understand the significance of skipping custom-themes or why it evaluates my leuven, monokai, and nyx as custom, but this line change fixes the problem for me.