机构模式:Symbol的函数定义无效:\, [英] Org Mode: Symbol's function definition is void: \,
问题描述
我正在尝试创建一个组织模式捕获模板,该模板将每个条目写入基于时间的文件名.
I'm trying to create an Org mode capture template that writes each entry to a time-based filename.
首先,在暂存缓冲区中有一个辅助函数:
First, there is a helper function that works in the scratch buffer:
;; Example input: (capture-date-based-file "~/path/to/logs/" "log")
;; Expected output: "~/path/to/logs/2017-11-27-monday-log.org"
(defun capture-date-based-file (path entry-type)
"Create a date-based file name based on the given type."
(downcase (concat path (format-time-string "%Y-%m-%d-%A-") entry-type ".org")))
然后,它在捕获模板列表中使用:
Then, it's used in the capture templates list:
(setq org-capture-templates
'(("l" "Log" entry (file+headline ,(capture-date-based-file "~/path/to/logs/" "log"))
"* %?\n%U\n" :clock-in t :clock-resume t) ))
我得到一个错误:符号的函数定义无效:\,
由于逗号,很难在Google中找到答案.我查看了文档,但不确定自己做错了什么.
It's difficult to find an answer in Google, because of the comma character. I've looked over the docs, and I'm not sure what I'm doing wrong.
推荐答案
逗号表示您要评估对基于捕获日期的文件
的调用>,但是周围的格式是 quoted 而不是 backquoted ,这样就行不通了.
The comma suggests that you're wanting to evaluate the call to capture-date-based-file
, but the surrounding form is quoted rather than backquoted, so that won't work.
即这是两个截然不同的东西:
i.e. these are two quite different things:
'(foo ,(bar) baz)
`(foo ,(bar) baz)
请参见 Ch i g (elisp)反引号
RET
在带反引号的形式中,逗号使随后的形式立即被求值,然后将该求值的结果替换为带反引号的形式.以引号形式,,(bar)
只是保留为原义的,(bar)
.
In a backquoted form, the comma causes the form which follows to be evaluated immediately, and the result of that evaluation is then substituted into the backquoted form. In a quoted form, ,(bar)
simply remains as a literal ,(bar)
.
您看到的特定错误的原因是lisp阅读器产生以下内容:
The reason for the specific error you saw is that the lisp reader produces the following:
ELISP> (read ",(bar)")
(\, (bar))
因此,求值 ,(bar)
的任何尝试实际上是在调用不存在的函数 \,
Therefore any attempt to evaluate ,(bar)
is actually calling the non-existent function \,
(FWIW,您将遇到的不太明显的错误之一.)
(One of the less-obvious errors you'll encounter, FWIW.)
在您的情况下,我假设组织将特定的表单从模板结构中拉出并进行评估. M-x错误触发切换
最有可能向您确切显示发生这种情况的时间和地点.
In your scenario I presume that org pulls that particular form out of the template structure and evaluates it. M-x toggle-debug-on-error
would most likely show you exactly where and when this happens.
这篇关于机构模式:Symbol的函数定义无效:\,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!