【问题标题】:Macro that wrap set-face-attribute don't work包装 set-face-attribute 的宏不起作用
【发布时间】:2014-06-12 01:22:45
【问题描述】:

我想创建一个宏来改变这个:

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

进入

(term-color blue "#5555FF")

我试过这个:

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

但出现错误wrong-type-argument symbolp "#5555FF",我的宏有什么问题?

宏展开返回:

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

【问题讨论】:

    标签: emacs macros elisp


    【解决方案1】:

    nil 在宏扩展中明显缺失。

    试试

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

    【讨论】:

    • 领先我 15 秒! @jcubic,请接受这个。
    猜你喜欢
    • 2019-03-28
    • 1970-01-01
    • 1970-01-01
    • 2014-01-08
    • 2012-08-19
    • 2023-03-25
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多