Reputation: 325
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)
Upvotes: 3
Views: 416
Reputation: 17707
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:
(fset 'org-refile-to-TRASH
[?\C-c ?\C-w ?T ?R ?A ?S ?H return])
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. in global-set-key
, M-x
, etc.
Upvotes: 6