瀏覽代碼

Improve refile history to contain exact matches only

This was a proposal by Samuel Wales.  After the user selected a
refiles target, we make sure that the fully qualified target is in the
history, so that next time, UP will bring back exactly this target.
Carsten Dominik 16 年之前
父節點
當前提交
809fcf9d78
共有 2 個文件被更改,包括 10 次插入2 次删除
  1. 6 0
      lisp/ChangeLog
  2. 4 2
      lisp/org.el

+ 6 - 0
lisp/ChangeLog

@@ -1,3 +1,9 @@
+2009-07-20  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-refile-get-location): Tamper with refile history o
+	that history contains compete matches instead of the entered
+	string.
+
 2009-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-store-link): Never store a link to an inline task.

+ 4 - 2
lisp/org.el

@@ -6936,7 +6936,7 @@ For file links, arg negates `org-context-in-file-links'."
   (interactive "P")
   (org-load-modules-maybe)
   (setq org-store-link-plist nil)  ; reset
-  (let ((outline-regexp org-get-limited-outline-regexp)
+  (let ((outline-regexp (org-get-limited-outline-regexp))
 	link cpltxt desc description search txt custom-id)
     (cond
 
@@ -8542,7 +8542,9 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
 			nil 'org-refile-history))
     (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl)))
     (if pa
-	pa
+	(progn
+	  (setcar org-refile-history (car pa))
+	  pa)
       (when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
 	(setq parent (match-string 1 answ)
 	      child (match-string 2 answ))