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: Sat, 6 May 2017 07:51:14 +0200 Message-ID: <20170506055115.11705-1-seb@wirrsal.net> References: <87vapesxbn.fsf@kyleam.com> 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]:59661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6scs-0003ig-VC for emacs-orgmode@gnu.org; Sat, 06 May 2017 01:51:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6scp-0001U2-Vv for emacs-orgmode@gnu.org; Sat, 06 May 2017 01:51:31 -0400 Received: from wirrsal.net ([188.68.36.149]:40296 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 1d6scp-0001Rz-LT for emacs-orgmode@gnu.org; Sat, 06 May 2017 01:51:27 -0400 In-Reply-To: <87vapesxbn.fsf@kyleam.com> 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