emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 1/2] org-refile: escape slashes only in headline of refile target
@ 2017-05-03 17:50 Sebastian Reuße
  2017-05-03 17:50 ` [PATCH 2/2] org-refile: optionally prefix refile targets with buffer name Sebastian Reuße
  0 siblings, 1 reply; 20+ messages in thread
From: Sebastian Reuße @ 2017-05-03 17:50 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Sebastian Reuße

* 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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-05-07 10:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-03 17:50 [PATCH 1/2] org-refile: escape slashes only in headline of refile target Sebastian Reuße
2017-05-03 17:50 ` [PATCH 2/2] org-refile: optionally prefix refile targets with buffer name Sebastian Reuße
2017-05-03 20:30   ` [PATCH 1/2] org-refile: escape slashes only in headline of refile target Sebastian Reuße
2017-05-03 20:30     ` [PATCH 2/2] org-refile: optionally prefix refile targets with buffer name Sebastian Reuße
2017-05-03 20:33       ` Sebastian Reuße
2017-05-05 23:23       ` Kyle Meyer
2017-05-05 23:22     ` [PATCH 1/2] org-refile: escape slashes only in headline of refile target Kyle Meyer
2017-05-06  5:51       ` [PATCH 1/2] org-refile: Escape " Sebastian Reuße
2017-05-06  5:51         ` [PATCH 2/2] org-refile: Optionally prefix refile targets with buffer name Sebastian Reuße
2017-05-06  6:34           ` [PATCH 1/2] org-refile: Escape slashes only in headline of refile target Sebastian Reuße
2017-05-06  6:34             ` [PATCH 2/2] org-refile: Optionally prefix refile targets with buffer name Sebastian Reuße
2017-05-06  6:38               ` [PATCH 1/2] org-refile: Escape slashes only in headline of refile target Sebastian Reuße
2017-05-06  6:38                 ` [PATCH 2/2] org-refile: Optionally prefix refile targets with buffer name Sebastian Reuße
2017-05-06  6:41       ` [PATCH 1/2] org-refile: escape slashes only in headline of refile target Sebastian Reuße
2017-05-06 16:07         ` Kyle Meyer
2017-05-06 19:04           ` [PATCH] ORG-NEWS: Update new features Sebastian Reuße
2017-05-06 20:19             ` Kyle Meyer
2017-05-07 10:04               ` Nicolas Goaziou
2017-05-06  6:44       ` [PATCH 1/2] org-refile: escape slashes only in headline of refile target Sebastian Reuße
2017-05-06 16:08         ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).