![](/img/trans.png)
[英]Elisp: Symbol's value as variable is void with let* and (lambda)
[英]Elisp (void-variable\]) when trying to evaluate a function in property list
在我的 Spacemacs 配置中,我配置我的组织层来缩放它生成的任何乳胶
(org :variables
org-format-latex-options '(:foreground "#90ee90" :background default :scale 2.0
:html-foreground default
:html-background "Transparent" :html-scale 1 :matchers
("begin" "$1" "$" "$$" "\\(" "\\["))
我在多台机器上使用这个配置,我喜欢不同显示器的不同缩放比例,所以我写了一个小函数
(defun switch-scale ()
(cond
((equal (system-name) "WMachine") 5.0)
(t 2.0) ;; default
)
)
并重写上面的代码来调用 :scale 属性中的函数,像这样
org-format-latex-options '(:foreground "#90ee90" :background default :scale (switch-scale)
...
当我在临时缓冲区中测试 switch-scale 时,它工作正常(返回 5.0),但是当我将它添加到我的配置中时,它会在尝试在 org 模式下生成乳胶时触发以下错误
Debugger entered--Lisp error: (void-variable \])
eval(\] nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
我对正在发生的事情感到困惑,似乎(开关量程)只是没有被评估???
答案是我不理解 elisps 评估系统......所以因为它在一个引用列表中,该列表中的所有内容都是文字,所以我实际上需要使用反引号来引用列表,然后使用逗号来评估 (switch -scale) 函数,如此处所述https://www.gnu.org/software/emacs/manual/html_node/elisp/Backquote.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.