简体   繁体   中英

Emacs org-mode: refile using the goto-interface

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 Cc Cw 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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM