使用如下所示的捕获模板,我可以将条目添加到文件中的不同标题.如何在捕获过程中手动输入标题,而不是像我现在一样将每个标题设置为.emacs文件中的键?
(setq org-capture-templates
'(
("l" "Log" entry
(file+headline "c:/Org/log.org" "Log")
"\n\n** %?\n<%<%Y-%m-%d %a %T>>"
:empty-lines 1))
Run Code Online (Sandbox Code Playgroud)
看起来,至少在较新版本的org中,可以在捕获模板中使用自定义函数来执行此操作.
代替:
entry
(file+headline "~/Work/work.org" "Refile")
Run Code Online (Sandbox Code Playgroud)
您可以使用:
entry
(file+function "~/Work/work.org" function-finding-location)
Run Code Online (Sandbox Code Playgroud)
"功能查找位置"是您自己编写的自定义功能,可以轻松提示您标题.
或者,您可以更进一步,并定义一个自定义函数,它将提示文件名和标题名称(或您可以想到的任何其他内容):
entry
(function function-finding-location)
Run Code Online (Sandbox Code Playgroud)
我自己并不太了解elisp来编写这些函数,但这看起来像是开始的地方.如果其他人可以提供一些代码,那就太好了.相关文档在这里:
http://orgmode.org/manual/Template-elements.html
我编写了一个与 file+function 一起使用的函数,它会在捕获时提示输入位置。
它使用 org-refile 的内部提示功能,因此我们可以在提示中完成标题(最大级别覆盖为 9)。当用户输入未知标题时,它会在文件末尾创建它。
(defun org-ask-location ()
(let* ((org-refile-targets '((nil :maxlevel . 9)))
(hd (condition-case nil
(car (org-refile-get-location nil nil t t))
(error (car org-refile-history)))))
(goto-char (point-min))
(outline-next-heading)
(if (re-search-forward
(format org-complex-heading-regexp-format (regexp-quote hd))
nil t)
(goto-char (point-at-bol))
(goto-char (point-max))
(or (bolp) (insert "\n"))
(insert "* " hd "\n")))
(end-of-line))
Run Code Online (Sandbox Code Playgroud)
在您的情况下,您可以这样使用它:
(setq org-capture-templates
'(("l" "Log" entry
(file+function "c:/Org/log.org" org-ask-location)
"\n\n** %?\n<%<%Y-%m-%d %a %T>>"
:empty-lines 1))
Run Code Online (Sandbox Code Playgroud)
我不相信您可以在捕获时提示输入标题。但是,您可以从捕获窗口内重新归档,这应该会导致所需的行为。
我会定义一个包罗万象的目标标题/文件,这样如果您忘记了,您将始终将它们收集在同一位置,然后只需在创建后重新归档它们。如果您还在此标题上设置类别/标签,您将能够轻松查看错误归档的捕获条目并根据需要重新归档。(下例)
然后C-c C-c
选择重新提交而不是完成,系统C-c C-w
会要求您选择要将新条目发送到的标题。
我用于此捕获的捕获模板如下(改编自Bernt Hansen 的捕获设置)
("i"
"Incidents"
entry
(file+headline "~/Work/work.org" "Refile")
"* TODO %^{Ticket} - %^{User}\nSCHEDULED: %^t DEADLINE: %^t\n:PROPERTIES:
\n:DATE: %^U\n:END:\n%^{MANAGER}p%^{HOSTNAME}p%^{LOCATION}p%^{TEL}p\n%c"
:empty-lines 1 :clock-in t :clock-resume t)
Run Code Online (Sandbox Code Playgroud)
(添加换行符以避免在此处阅读时滚动)
标题配置如下
* Refile :refile:
:PROPERTIES:
:CATEGORY: Unsorted
:END:
Run Code Online (Sandbox Code Playgroud)
有了这个,我最终将所有未重新提交的任务显示为
Unsorted: Deadline: TODO <Headline> :refile::
Run Code Online (Sandbox Code Playgroud)
我目前倾向于使用标签作为参考,如果我正在等待同事/经理处理票证,或者当我看到他们时提醒我与他们谈论这件事,以便最后的标签清晰地突出,就像未分类一样如果我想记住问题是什么(因为我只显示了一个案例编号和用户名,条目中的详细信息)。
归档时间: |
|
查看次数: |
1755 次 |
最近记录: |