diff options
author | Bastien <bzg@gnu.org> | 2020-02-13 00:28:51 +0100 |
---|---|---|
committer | Bastien <bzg@gnu.org> | 2020-02-13 00:28:51 +0100 |
commit | 63fd0c09ca1bf55c335062ebcf6be4bbdc147a25 (patch) | |
tree | 1dfdc0ed299989c3ffe6395534b17844b552518f | |
parent | be93859c78e26c0f33f6c9d459b34a3945734283 (diff) | |
download | org-mode-63fd0c09ca1bf55c335062ebcf6be4bbdc147a25.tar.gz |
org-refile.el: Small refactoring, fix a minor bug
* lisp/org-refile.el (org-refile-get-location): Small
refactoring and fix a minor bug, duplicating refile targets
available for completion.
Thanks to Gustavo Barros for the detailed explanations about
this bug.
-rw-r--r-- | lisp/org-refile.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/org-refile.el b/lisp/org-refile.el index e696945..5ad9e90 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -773,26 +773,29 @@ this function appends the default value from org-refile-target-table)) (completion-ignore-case t) cdef + (last-refile-loc (car org-refile-history)) + (last-refile-loc-path (concat last-refile-loc + (if org-refile-use-outline-path "/"))) (prompt (concat prompt - (or (and (car org-refile-history) - (concat " (default " (car org-refile-history) ")")) + (or (and last-refile-loc + (concat " (default " last-refile-loc ")")) (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 (or cdef (car org-refile-history)))) + nil 'org-refile-history (or cdef last-refile-loc-path))) (if (setq pa (org-refile--get-location answ tbl)) (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)))) + (not (equal (car pa) last-refile-loc))) (setq org-refile-history - (cons (car pa) (if (assoc (car org-refile-history) tbl) + (cons (car pa) (if (assoc last-refile-loc tbl) org-refile-history (cdr org-refile-history)))) - (when (equal (car org-refile-history) (nth 1 org-refile-history)) + (when (equal last-refile-loc (nth 1 org-refile-history)) (pop org-refile-history))) pa) (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) |