0
votes

I want to create macro that will transform this:

(set-face-attribute 'term-color-blue nil :foreground "#5555FF")

into

(term-color blue "#5555FF")

I've try this:

(defmacro term-color (name color)
  `(set-face-attribute ',(intern (concat "term-color-" (symbol-name name)))
                       :foreground ,color))

but got error wrong-type-argument symbolp "#5555FF", what's wrong with my macro?

Macroexpand return:

(set-face-attribute (quote term-color-blue) :foreground "#5555FF")
1

1 Answers

1
votes

nil is conspicuously missing from the macroexpansion.

Try

(defmacro term-color (name color)
  `(set-face-attribute ',(intern (concat "term-color-" (symbol-name name)))
                       nil :foreground ,color))