I have several project directories with the same structure. As a result, I am often annoyed when I have to refile (C-c C-w) some sections because several buffers have the same names.

For instance, the list of targets Emacs shows me is something like:


How can I configure Emacs to disambiguate these refile targets name?


A first solution solution is to define

(setq org-refile-use-outline-path 'full-file-path)

you will get full file paths, however, this can be quite long:


and thus reduce readability.

A second solution, I prefer, is to use:

(setq org-refile-use-outline-path 'buffer-name)

in conjunction with the uniquify package.

Once configured with:

(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)

you will get (when refiling):


which it the best of two worlds: short but unambiguous refile targets.

Note: to make it works with helm (M-x helm-mode) you must let Org generates all of the possible completions and present them at once thanks to:

(setq org-outline-path-complete-in-steps nil)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.