protesilaos / ef-themes

Colourful and legible themes for GNU Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ef-themes-with-colors throws error

stevemolitor opened this issue · comments

Executing the example code in section "9. Use colors from the active Ef theme":

(ef-themes-with-colors
 (list bg-main fg-main bg-mode-line cursor))

Gives this error:

Symbol’s value as variable is void: ef-light-palette

The error happens here. It seems to have been introduced in this commit: e5e8ada. The ef-light-pallette constant has not been defined yet apparently.

If I select the ef-light-theme first then it works fine (which makes sense).

Thank @stevemolitor! Your assessment is correct. I need to think about an elegant way to do this. Will think about it some more and report back to you.

Maybe you can try this diff?

 ef-themes.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ef-themes.el b/ef-themes.el
index 9a60504..377935c 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -1518,7 +1518,7 @@ (defmacro ef-themes-with-colors (&rest body)
          ;; instantiate the actual theme's palette.  We have to do this
          ;; otherwise the macro does not work properly when called from
          ;; inside a function.
-         (colors (mapcar #'car (symbol-value 'ef-light-palette))))
+         (colors (mapcar #'car (ef-themes--current-theme-palette))))
     `(let* ((c '((class color) (min-colors 256)))
             (,sym (ef-themes--current-theme-palette))
             ,@(mapcar (lambda (color)

I tested it with these:

(defun testing-ef-themes-with-colors ()
  (ef-themes-with-colors
    (list bg-main)))

;; Evaluate these, change theme and eval again to see if you get a
;; different value:
(ef-themes-with-colors (list bg-main))

(testing-ef-themes-with-colors)

@protesilaos I can confirm that your diff above fixes the issue.

Thanks again!

Thank you! Just pushed the change. Closing this now.