summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-09-23 10:04:29 +0200
committerBastien Guerry <bzg@altern.org>2012-09-23 10:04:29 +0200
commitf19af99d2a74b7a3ceb2d66626955b7704cb9788 (patch)
tree346bcb898d6e90276460893ad98c08196aaa945f
parent1fea5530e33fbffb8bbbe2d28b36f208ba6cfe7d (diff)
downloadorg-mode-f19af99d2a74b7a3ceb2d66626955b7704cb9788.tar.gz
org.el: Use the current file name as the default target when there is no refile history
* org.el (org-refile-get-location): Use the current file name as the default target when there is no refile history.
-rw-r--r--lisp/org.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el
index fe63b62..e139846 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11114,11 +11114,7 @@ this is used for the GOTO interface."
(org-refile-get-targets default-buffer excluded-entries)))
(unless org-refile-target-table
(error "No refile targets"))
- (let* ((prompt (concat prompt
- (and (car org-refile-history)
- (concat " (default " (car org-refile-history) ")"))
- ": "))
- (cbuf (current-buffer))
+ (let* ((cbuf (current-buffer))
(partial-completion-mode nil)
(cfn (buffer-file-name (buffer-base-buffer cbuf)))
(cfunc (if (and org-refile-use-outline-path
@@ -11126,6 +11122,7 @@ this is used for the GOTO interface."
'org-olpath-completing-read
'org-icompleting-read))
(extra (if org-refile-use-outline-path "/" ""))
+ (cbnex (concat (buffer-name) extra))
(filename (and cfn (expand-file-name cfn)))
(tbl (mapcar
(lambda (x)
@@ -11138,10 +11135,16 @@ this is used for the GOTO interface."
(cons (concat (car x) extra) (cdr x))))
org-refile-target-table))
(completion-ignore-case t)
+ cdef
+ (prompt (concat prompt
+ (or (and (car org-refile-history)
+ (concat " (default " (car org-refile-history) ")"))
+ (and (assoc cbnex tbl) (setq cdef cbnex)
+ (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)
- nil 'org-refile-history (car org-refile-history)))
+ nil 'org-refile-history (or cdef (car org-refile-history))))
(setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl)))
(org-refile-check-position pa)
(if pa