org.el (org-refile--get-location): New internal function
* org.el (org-refile--get-location): New internal function using a wider set of possible refile locations. (org-refile-get-location): Use it.
This commit is contained in:
parent
f3ed0f7c6c
commit
53c664c4ec
17
lisp/org.el
17
lisp/org.el
|
@ -11641,6 +11641,17 @@ prefix argument (`C-u C-u C-u C-c C-w')."
|
||||||
(bookmark-jump "org-refile-last-stored")
|
(bookmark-jump "org-refile-last-stored")
|
||||||
(message "This is the location of the last refile"))
|
(message "This is the location of the last refile"))
|
||||||
|
|
||||||
|
(defun org-refile--get-location (refloc tbl)
|
||||||
|
"When user refile to REFLOC, find the associated target in TBL.
|
||||||
|
Also check `org-refile-target-table'."
|
||||||
|
(car (delq
|
||||||
|
nil
|
||||||
|
(mapcar
|
||||||
|
(lambda (r) (or (assoc r tbl)
|
||||||
|
(assoc r org-refile-target-table)))
|
||||||
|
(list (replace-regexp-in-string "/$" "" refloc)
|
||||||
|
(replace-regexp-in-string "\\([^/]\\)$" "\\1/" refloc))))))
|
||||||
|
|
||||||
(defun org-refile-get-location (&optional prompt default-buffer new-nodes
|
(defun org-refile-get-location (&optional prompt default-buffer new-nodes
|
||||||
no-exclude)
|
no-exclude)
|
||||||
"Prompt the user for a refile location, using PROMPT.
|
"Prompt the user for a refile location, using PROMPT.
|
||||||
|
@ -11694,8 +11705,7 @@ this is used for the GOTO interface."
|
||||||
(setq old-hist org-refile-history)
|
(setq old-hist org-refile-history)
|
||||||
(setq answ (funcall cfunc prompt tbl nil (not new-nodes)
|
(setq answ (funcall cfunc prompt tbl nil (not new-nodes)
|
||||||
nil 'org-refile-history (or cdef (car org-refile-history))))
|
nil 'org-refile-history (or cdef (car org-refile-history))))
|
||||||
(setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl)))
|
(if (setq pa (org-refile--get-location answ tbl))
|
||||||
(if pa
|
|
||||||
(progn
|
(progn
|
||||||
(org-refile-check-position pa)
|
(org-refile-check-position pa)
|
||||||
(when (or (not org-refile-history)
|
(when (or (not org-refile-history)
|
||||||
|
@ -11712,8 +11722,7 @@ this is used for the GOTO interface."
|
||||||
(progn
|
(progn
|
||||||
(setq parent (match-string 1 answ)
|
(setq parent (match-string 1 answ)
|
||||||
child (match-string 2 answ))
|
child (match-string 2 answ))
|
||||||
(setq parent-target (or (assoc parent tbl)
|
(setq parent-target (org-refile--get-location parent tbl))
|
||||||
(assoc (concat parent "/") tbl)))
|
|
||||||
(when (and parent-target
|
(when (and parent-target
|
||||||
(or (eq new-nodes t)
|
(or (eq new-nodes t)
|
||||||
(and (eq new-nodes 'confirm)
|
(and (eq new-nodes 'confirm)
|
||||||
|
|
Loading…
Reference in New Issue