From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Subject: [PATCH 1/2] org-refile: escape slashes only in headline of refile target Date: Wed, 3 May 2017 22:30:45 +0200 Message-ID: <20170503203046.31610-1-seb@wirrsal.net> References: <20170503175003.22151-2-seb@wirrsal.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d60vL-0000LD-Os for emacs-orgmode@gnu.org; Wed, 03 May 2017 16:31:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d60vH-0004F0-R0 for emacs-orgmode@gnu.org; Wed, 03 May 2017 16:30:59 -0400 Received: from wirrsal.net ([188.68.36.149]:57830 helo=mail.wirrsal.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d60vH-0004BF-Gz for emacs-orgmode@gnu.org; Wed, 03 May 2017 16:30:55 -0400 In-Reply-To: <20170503175003.22151-2-seb@wirrsal.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Cc: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= * 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=E2=80=99t result in any confusion and serve= s 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 defaul= t-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))) --=20 2.12.2