Dear maintainers,
   I may have found a bug relate to org-refile function,though I have not
push privileges,I submit a patch using git format-patch.
   Wait for your review, awesome Org mode!!
From 866b7be3536d92eb7d7b04cdd48a8b806b9b7253 Mon Sep 17 00:00:00 2001
From: Vacker <fantans...@gmail.com>
Date: Sun, 22 Dec 2013 16:33:28 +0800
Subject: [PATCH] check refile position when the position is not nil

# background
  when use ido-mode to refile,type a unexist heading always trigger error
'Please indicate a target file in the refile path'
even after set org-refile-allow-creating-parent-nodes to 'confirm
or 'file.

# debugging result see the code comments
---
 lisp/org.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1f20bfd..84f2a60 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11801,12 +11801,16 @@ this is used for the GOTO interface."
 				  (concat " (default " cbnex ")"))) ": "))
 	 pa answ parent-target child parent old-hist)
     (setq old-hist org-refile-history)
+    ;;answ will be the new (not exist) heading you type through org-icompleting-read
     (setq answ (funcall cfunc prompt tbl nil (not new-nodes)
 			nil 'org-refile-history (or cdef (car org-refile-history))))
+    ;;but tbl is fixed not containing the new heading,
+    ;;so pa is always nil
+    ;;we could let org-refile-check-position work when pa is not nil
     (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl)))
-    (org-refile-check-position pa)
     (if pa
 	(progn
+	  (org-refile-check-position pa)
 	  (when (or (not org-refile-history)
 		    (not (eq old-hist org-refile-history))
 		    (not (equal (car pa) (car org-refile-history))))
-- 
1.8.5.2

Reply via email to