Browse Source

Merge branch 'maint'

Bastien 7 years ago
parent
commit
a402419716
1 changed files with 11 additions and 4 deletions
  1. 11 4
      lisp/org.el

+ 11 - 4
lisp/org.el

@@ -4819,6 +4819,12 @@ Support for group tags is controlled by the option
   (message "Groups tags support has been turned %s"
 	   (if org-group-tags "on" "off")))
 
+(defun org-tag-add-to-alist (alist1 alist2)
+  "Append ALIST1 elements to ALIST2 if they are not there yet."
+  (let (to-add)
+    (dolist (i alist1) (unless (member i alist2) (push i to-add)))
+    (append to-add alist2)))
+
 (defun org-set-regexps-and-options (&optional tags-only)
   "Precompute regular expressions used in the current buffer.
 When optional argument TAGS-ONLY is non-nil, only compute tags
@@ -4847,10 +4853,11 @@ related expressions."
 		  (mapcar #'org-add-prop-inherited
 			  (cdr (assq 'filetags alist))))
       (setq org-current-tag-alist
-	    (append org-tag-persistent-alist
-		    (let ((tags (cdr (assq 'tags alist))))
-		      (if tags (org-tag-string-to-alist tags)
-			org-tag-alist))))
+	    (org-tag-add-to-alist
+	     org-tag-persistent-alist
+	     (let ((tags (cdr (assq 'tags alist))))
+	       (if tags (org-tag-string-to-alist tags)
+		 org-tag-alist))))
       (setq org-tag-groups-alist
 	    (org-tag-alist-to-groups org-current-tag-alist))
       (unless tags-only