【问题标题】:Elisp (void-variable\]) when trying to evaluate a function in property list尝试评估属性列表中的函数时的 Elisp (void-variable\])
【发布时间】:2020-10-15 23:13:12
【问题描述】:

在我的 Spacemacs 配置中,我将我的 org 层配置为像这样扩展它生成的任何乳胶

(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)

我不知道发生了什么,似乎 (switch-scale) 没有被评估???

【问题讨论】:

    标签: debugging emacs spacemacs


    【解决方案1】:

    答案是我不了解 elisps 评估系统......所以因为它在一个带引号的列表中,该列表中的所有内容都是文字,所以我实际上需要使用反引号来引用列表,然后使用逗号来评估(switch-scale) 函数,此处解释为https://www.gnu.org/software/emacs/manual/html_node/elisp/Backquote.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-28
      • 1970-01-01
      • 2013-01-10
      • 1970-01-01
      • 2011-06-30
      相关资源
      最近更新 更多