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 08:34:31 +0200 Message-ID: <20170506063432.17977-1-seb@wirrsal.net> References: <20170506055115.11705-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]:37505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6tIi-0004LJ-Jw for emacs-orgmode@gnu.org; Sat, 06 May 2017 02:34:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6tIf-0000A3-FX for emacs-orgmode@gnu.org; Sat, 06 May 2017 02:34:44 -0400 Received: from wirrsal.net ([188.68.36.149]:40740 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 1d6tIf-00009o-4i for emacs-orgmode@gnu.org; Sat, 06 May 2017 02:34:41 -0400 In-Reply-To: <20170506055115.11705-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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 0d83b4cbd..5d8166c99 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11576,7 +11576,7 @@ (defun org-refile-get-targets (&optional default-= buffer) (target (if (not org-refile-use-outline-path) heading (mapconcat - #'org-protect-slash + #'identity (append (pcase org-refile-use-outline-path (`file (list (file-name-nondirectory @@ -11586,7 +11586,8 @@ (defun org-refile-get-targets (&optional default-= buffer) (list (buffer-file-name (buffer-base-buffer)))) (_ nil)) - (org-get-outline-path t t)) + (mapcar #'org-protect-slash + (org-get-outline-path t t))) "/")))) (push (list target f re (org-refile-marker (point))) tgs))) --=20 2.12.2