forked from mirrors/org-mode
Refile: Catch invalid target specification
Patch by Jason Dunsmore.
This commit is contained in:
parent
b3ffb6a9b9
commit
e45c431ce9
|
@ -1,3 +1,8 @@
|
|||
2010-03-19 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.el (org-refile-get-location): Catch an invalid target
|
||||
specification.
|
||||
|
||||
2010-03-18 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
|
||||
|
|
22
lisp/org.el
22
lisp/org.el
|
@ -9481,15 +9481,19 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
|
|||
(if (equal (car org-refile-history) (nth 1 org-refile-history))
|
||||
(pop org-refile-history)))
|
||||
pa)
|
||||
(when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
|
||||
(setq parent (match-string 1 answ)
|
||||
child (match-string 2 answ))
|
||||
(setq parent-target (or (assoc parent tbl) (assoc (concat parent "/") tbl)))
|
||||
(when (and parent-target
|
||||
(or (eq new-nodes t)
|
||||
(and (eq new-nodes 'confirm)
|
||||
(y-or-n-p (format "Create new node \"%s\"? " child)))))
|
||||
(org-refile-new-child parent-target child))))))
|
||||
(if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
|
||||
(progn
|
||||
(setq parent (match-string 1 answ)
|
||||
child (match-string 2 answ))
|
||||
(setq parent-target (or (assoc parent tbl)
|
||||
(assoc (concat parent "/") tbl)))
|
||||
(when (and parent-target
|
||||
(or (eq new-nodes t)
|
||||
(and (eq new-nodes 'confirm)
|
||||
(y-or-n-p (format "Create new node \"%s\"? "
|
||||
child)))))
|
||||
(org-refile-new-child parent-target child)))
|
||||
(error "Invalid target location")))))
|
||||
|
||||
(defun org-refile-new-child (parent-target child)
|
||||
"Use refile target PARENT-TARGET to add new CHILD below it."
|
||||
|
|
Loading…
Reference in New Issue