Hi Samuel,
Samuel Wales <[email protected]> writes:
> Would this also get rid of the current-file special case? If so, this
> sounds good to me and I will test it.
Please test the attached patch against maint and let me know what
issues it fixes for you.
Thanks,
diff --git a/lisp/org.el b/lisp/org.el
index 23126b3..9a648dd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11308,7 +11308,7 @@ on the system \"/user@host:\"."
txt (org-link-display-format (match-string 4))
txt (replace-regexp-in-string "\\( *\[[0-9]+/?[0-9]*%?\]\\)+$" "" txt)
re (format org-complex-heading-regexp-format
- (regexp-quote (match-string 4))))
+ (regexp-quote (match-string-no-properties 4))))
(when org-refile-use-outline-path
(setq txt (mapconcat
'org-protect-slash
@@ -11641,6 +11641,12 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(bookmark-jump "org-refile-last-stored")
(message "This is the location of the last refile"))
+(defsubst org-refile--get-location (answ tbl)
+ (or (assoc answ tbl)
+ (assoc (concat answ "/") tbl)
+ (assoc answ org-refile-target-table)
+ (assoc (concat answ "/") org-refile-target-table)))
+
(defun org-refile-get-location (&optional prompt default-buffer new-nodes
no-exclude)
"Prompt the user for a refile location, using PROMPT.
@@ -11692,10 +11698,9 @@ this is used for the GOTO interface."
(concat " (default " cbnex ")"))) ": "))
pa answ parent-target child parent old-hist)
(setq old-hist org-refile-history)
- (setq answ (funcall cfunc prompt tbl nil (not new-nodes)
+ (setq answ (funcall cfunc prompt tbl nil (if new-nodes 'confirm t)
nil 'org-refile-history (or cdef (car org-refile-history))))
- (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl)))
- (if pa
+ (if (setq pa (org-refile--get-location answ tbl))
(progn
(org-refile-check-position pa)
(when (or (not org-refile-history)
@@ -11712,8 +11717,7 @@ this is used for the GOTO interface."
(progn
(setq parent (match-string 1 answ)
child (match-string 2 answ))
- (setq parent-target (or (assoc parent tbl)
- (assoc (concat parent "/") tbl)))
+ (setq parent-target (org-refile--get-location parent tbl))
(when (and parent-target
(or (eq new-nodes t)
(and (eq new-nodes 'confirm)
--
Bastien