通过键绑定重新归档到给定的子树
问题可能很简单,但我很挣扎,因为我是 ELISP 的新手。
我想要一个键绑定将当前子树重新归档到子树 TRASH。
我已经写了代码,但是不起作用。你能帮我解决它吗? 提前致谢!
代码:
(defun org-move-to-trash()
(org-refile "TRASH") ;; the function fails here because the parameter has to be specified in a different way. But how?
)
(global-set-key (kbd "C-c b") 'org-move-to-trash)
The problem is probably very simple, but I'm struggling because I am new to ELISP.
I want to have a keybinding to refile current subtree to subtree TRASH.
I have written the code, which doesn't work, though. Could you please help me to fix it?
Thanks in advance!
The code:
(defun org-move-to-trash()
(org-refile "TRASH") ;; the function fails here because the parameter has to be specified in a different way. But how?
)
(global-set-key (kbd "C-c b") 'org-move-to-trash)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您对 elisp 感兴趣,您可以阅读 org-refile 的源代码,了解如何准备它期望的参数(这不是直接的)。然而,要解决这个问题以及许多其他更普遍的问题,您根本不需要 elisp。你需要一个键盘宏。请参阅手册。
我将概述解决此问题的步骤:
您应该看到:
您可以将此代码粘贴到您的 init 文件中,并使用
org-refile-to-TRASH
作为命令,就像它是一个 defun 一样,例如在global-set-key
、Mx
等中。If you're interested in elisp, you can read the source of org-refile to see how to prepare the arguments it expects (it's not straight forward). However, to solve this and many other more general problems, you don't need elisp at all. You need a keyboard macro. See manual.
I'll outline the steps I would take to solve this:
You should see:
You can paste this code into your init file, and use
org-refile-to-TRASH
as a command, exactly like if it were a defun e.g. inglobal-set-key
,M-x
, etc.