org-mode - 如何在交互式输入标题下捕获注释
问题描述
我正在使用这篇文章中的捕获模板。该脚本让我可以选择我想在哪个标题下提交我的新笔记。我想使用这个脚本,以便我可以在女巫标题下动态选择来提交我的新笔记。
而不是使用entry (file+headline "~/org/gtd.org" "Movies")
预定义标题的位置
不幸的是,这个脚本不能正常工作。它不会将其写入正确的标题下,而是使用此结果创建一个新标题
* inbox.org/Movies
* Watch new james bond movie
<2020-07-12 Sun 17:03:28>
而不是在 inbox.org 文件中创建标题
* Movies
** Watch new james bond movie
<2020-07-12 Sun 17:03:28>
(setq org-capture-templates
(append org-capture-templates
(quote (
("t" "add task")
("to" "other"
entry (file+function "~/org/gtd.org" org-ask-location)
"\n\n** %?\n<%<%Y-%m-%d %a %T>>"
:empty-lines 1)
)
)
)
)
(defun org-ask-location ()
(let* ((org-refile-targets '((nil :maxlevel . 9)))
(hd (condition-case nil
(car (org-refile-get-location "Headline" nil 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\n"))
(insert "* " hd "\n\n")))
(end-of-line))
解决方案
推荐阅读
- mysql - Mysql用事务在多个表中插入多行
- azure - 如何将 Microsoft Access 数据库引擎或 OLEDB 安装到 Azure SQL 数据库
- c# - 具有通用处理程序和查询的 Mediatr
- c# - 在 Startup 中合并 aspnetcore 项,无需重复服务注册或管道
- django - 芹菜任务未在提供的开始时间开始
- python - 字典方法而不是 exec 方法
- r - 来自提供状态代码的 url 的响应令牌
- x86 - AVX2 中的通道内、跨 64 位元素数据移动
- listbox - Excel Listbox 显示默认值但不保留在 Sub 中
- tensorflow - 'input_length' 是什么意思?