问题
I often use the capture-refile-archive structure of org-mode but I have problem with the way the refiling works. I use IDO completion so that when I refile a tree C-c C-w I get all the possible trees to refile under in the mini-buffer.
However, this results in a huge number of possible completions that really aren't very readable. It would be far better if you could choose a refile file location and then use the org-goto-interface temporary buffer to choose a particular subtree.
Does anybody know how this could be done?
回答1:
Perhaps the settings you are looking for are
(setq org-refile-use-outline-path 'file)
(setq org-outline-path-complete-in-steps t)
org-refile-use-outline-path lets you give the refile targets as paths (file.org/heading/subheading) and org-outline-path-complete-in-steps will pause after competing each stage of the path. Start refiling, type the path and press [tab] to get a list of all the top level headlines. Continue to the location you want.
回答2:
You can do this by setting org-refile-targets before running
org-refile. For example, I've
described doing
this for selecting and refiling to Org files that aren't in the global
org-refile-targets. That was focused on having functions other than
org-refile to handle special cases, but if you wanted org-refile to
always ask for a buffer or file to refile to, you could advise
org-refile to override org-refile-targets or you could set
org-refile-targets to a function that returns a selected buffer.
(defun km/get-open-org-file ()
(buffer-file-name
(get-buffer
(org-icompleting-read "Buffer: "
(mapcar 'buffer-name
(org-buffer-list 'files))))))
(setq org-refile-targets '((km/get-open-org-file . (:maxlevel . 2))))
How exactly you set up org-refile-targets depends a lot on your work
flow and structure for notes, but those examples hopefully give you an
idea of how you can get things working the way you want.
来源:https://stackoverflow.com/questions/26651382/emacs-org-mode-refile-using-the-goto-interface