瀏覽代碼

* lisp/org.el (org-set-tags-command): Put local tags on top

See https://orgmode.org/list/7AB4F327-24D0-4BA5-BD20-B329D4CBBF0A@hoowl.se
Ihor Radchenko 2 年之前
父節點
當前提交
a0b21e3f1c
共有 1 個文件被更改,包括 11 次插入5 次删除
  1. 11 5
      lisp/org.el

+ 11 - 5
lisp/org.el

@@ -11465,12 +11465,18 @@ in Lisp code use `org-set-tags' instead."
       (save-excursion
 	(org-back-to-heading)
 	(let* ((all-tags (org-get-tags))
+               (local-table (or org-current-tag-alist (org-get-buffer-tags)))
 	       (table (setq org-last-tags-completion-table
-			    (org--tag-add-to-alist
-			     (and org-complete-tags-always-offer-all-agenda-tags
-				  (org-global-tags-completion-table
-				   (org-agenda-files)))
-			     (or org-current-tag-alist (org-get-buffer-tags)))))
+                            (append
+                             ;; Put local tags in front.
+                             local-table
+                             (cl-set-difference
+			      (org--tag-add-to-alist
+			       (and org-complete-tags-always-offer-all-agenda-tags
+				    (org-global-tags-completion-table
+				     (org-agenda-files)))
+			       local-table)
+                              local-table))))
 	       (current-tags
 		(cl-remove-if (lambda (tag) (get-text-property 0 'inherited tag))
 			      all-tags))