组织模式捕获:动态文件名 [英] org-mode capture : dynamic file name

查看:81
本文介绍了组织模式捕获:动态文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过:

如何为组织捕获输入动态文件条目

,但无法使其正常工作;我得到无效的文件位置:无。是否已在组织模式或Emacs本身中进行了某些更改以阻止其工作?否则:关于如何调试出问题的建议?

but cannot get it to work; I get "Invalid file location: nil". Has something changed in org-mode or in Emacs itself to stop this from working? Otherwise: suggestions for how to debug what has gone wrong?

我真正要开始工作的是本页上的描述:

What I'm really trying to get working is what is described on this page:

http://www.howardism.org /Technical/Emacs/journaling-org.html

我感兴趣的捕获模板始终是底部的日记本页面的

The capture template I'm interested in is the "Journal Note" one all the way at the bottom of the page:

(setq org-capture-templates '(
;; ...
("j" "Journal Note"
     entry (file (get-journal-file-today))
     "* Event: %?\n\n  %i\n\n  From: %a"
     :empty-lines 1)
;; ..
))

谢谢您的帮助。

推荐答案

弄清楚了...它使用的是反引号而不是整个捕获模板块的正常报价!我之所以错过了,是因为我看到的所有答案都只有一个捕获模板,并且前面带有反引号。我尝试过这样做,但是如果模板是其中的一个,那么这是行不通的。

Figured it out ... it is using a backquote instead of a normal quote for the entire capture template block! I missed this because all of the answers I saw had only a single capture template with a backquote in front of it; I tried doing that but this doesn't work if the template is "one of" ...

因此,此代码段比我发现的要丰富一些;我希望它对其他人有帮助。

So here is a snippet a bit richer than those I found; I hope it helps someone else.

(setq org-capture-templates
  `(("t" "TODO" entry (file+datetree "~/Documents/org/tasks.org"  "Tasks")
     "* TODO [#C] %?\n   SCHEDULED: <%<%Y-%m-%d %a>>\n  [%<%Y-%m-%d %a>]\n  %a")
   ("T" "Travel" entry (file+datetree+prompt "~/Documents/org/travel.org")
    "* %?\n  :PROPERTIES:\n  :LOCATION:\n  :END:\n  %t\n  %a")
   ("j" "Journal Note" entry (
               file+olp+datetree
               ,(concat
                 org-journal-dir
                 (format-time-string "journal-%m-%d.org")))
   "* Event: %?\n %i\n  From: %a")
   )
  )

键是捕获模板def块开始处的反引号`,前面是逗号(concat ...)调用该函数。

The keys are the backquote ` at the start of the capture template def block, and the comma , before (concat ... ) on the function being called.

这篇关于组织模式捕获:动态文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆