* org.el (org-refile-get-targets): only escape slashes in headline part of refile target; leave any file-system path component (when enabled) unescaped.
The reason to escape slashes in refile targets is to make it clear when a slash was part of a headline vs. part of the outline path. It makes sense to treat slashes in the file system part the same way as outline paths, since this won’t result in any confusion and serves to make target selection less noisy. --- lisp/org.el | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 0d83b4cbd..ad92f3b2e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11575,18 +11575,17 @@ (defun org-refile-get-targets (&optional default-buffer) (regexp-quote heading))) (target (if (not org-refile-use-outline-path) heading - (mapconcat - #'org-protect-slash - (append + (string-join + (cons (pcase org-refile-use-outline-path - (`file (list (file-name-nondirectory - (buffer-file-name - (buffer-base-buffer))))) - (`full-file-path - (list (buffer-file-name - (buffer-base-buffer)))) - (_ nil)) - (org-get-outline-path t t)) + (`file (file-name-nondirectory + (buffer-file-name + (buffer-base-buffer)))) + (`full-file-path (buffer-file-name + (buffer-base-buffer))) + (_ "")) + (mapcar #'org-protect-slash + (org-get-outline-path t t))) "/")))) (push (list target f re (org-refile-marker (point))) tgs))) -- 2.12.2