【发布时间】:2012-10-15 21:53:27
【问题描述】:
我一直在尝试改进我的 org-fu,我的任务之一是重新归档列表项。 出于各种原因,我通常更喜欢使用列表项(主要是 - 考虑到我的任务量,不要乱扔我的 CONTENT 视图,并且有一个真实的大纲)。
但是,可惜,当我尝试重新提交使用捕获系统创建的列表项时,我收到一个错误 - 我不允许这样做,因为它“没有意义”。
有没有办法覆盖这种行为?
编辑: ATM 我只设法重新归档条目(即标题),然后手动将它们转换为列表项。我认为有比这更好的解决方案...
我在 org-capture.el 中找到了这个函数:
(defun org-capture-refile ()
"Finalize the current capture and then refile the entry.
Refiling is done from the base buffer, because the indirect buffer is then
already gone. Any prefix argument will be passed to the refile command."
(interactive)
(unless (eq (org-capture-get :type 'local) 'entry)
(error
"Refiling from a capture buffer makes only sense for `entry'-type templates"))
(let ((pos (point))
(base (buffer-base-buffer (current-buffer)))
(org-refile-for-capture t))
(org-capture-finalize)
(save-window-excursion
(with-current-buffer (or base (current-buffer))
(save-excursion
(save-restriction
(widen)
(goto-char pos)
(call-interactively 'org-refile)))))))
如何将(unless (eq (org-capture-get :type 'local) 'entry)的部分去掉才能生效?
编辑:23.10.12
到目前为止,我设法让它工作:
(defun narrow-and-reveal ()
"Narrow and reveal all content"
(org-narrow-to-subtree)
(org-show-subtree)
)
(defun widen-and-outline ()
"Widen and move to beginning of file"
(widen)
(beginning-of-buffer)
(org-overview)
(org-content)
)
(defun org-goto-symbol ()
"Will navigate to the symbol at the current point of the cursor"
(widen-and-outline)
(interactive)
(let ((current-prefix-arg 4)) ;; emulate C-u
(call-interactively 'org-refile)) ;; invoke org-refile interactively
(narrow-and-reveal)
)
(defun custom-org-prompt-headline ()
(org-goto-symbol) ;; invoke org-refile interactively
(end-of-buffer))
(setq org-capture-templates`(
("t" "ToDo" item (file+function (concat org-directory "ToDo.org") custom-org-prompt-headline))))
但在输入列表项本身之前,它会提示我输入文件中的部分,我觉得这有点让人分心。 我只想选择重新归档列表项。我无法想象它应该那么难实现..是吗?
【问题讨论】:
-
既然你已经说清楚了,为什么refiling 不是你的解决方案,在你写下注释后使用
C-c C-w而不是C-c C-c?我不擅长 elisp,但我不明白你想要实现的现有功能没有涵盖的内容。 -
这实际上是我的问题 - 为什么我不能重新归档列表项?由于某种原因我无法完全理解,org-mode 不允许我这样做。
-
换一种说法(我认为),有没有办法只用一行文本而不是标题来使用 refile(能够在所有 org 缓冲区中快速搜索标题)。我个人会发现这对于在现有标题下复制笔记非常有用。