From c8c2d2b1f715158a1f55a7eaf4797c78562b4402 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 28 Apr 2016 22:04:49 +0200 Subject: [PATCH] Fix multiple groups of mutually exclusive tags * lisp/org.el (org-set-tags): Use a subtler mechansim to remove duplicate tags. This fixes a bug introduced in 77b4fad. Reported-by: Christoph LANGE --- lisp/org.el | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 382dbdfe2..1d3e129cf 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15016,17 +15016,27 @@ When JUST-ALIGN is non-nil, only align tags." (if just-align current ;; Get a new set of tags from the user. (save-excursion - (let* ((table + (let* ((seen) + (table (setq org-last-tags-completion-table - (delete-dups - (append - org-tag-persistent-alist - (or org-tag-alist (org-get-buffer-tags)) - (and - org-complete-tags-always-offer-all-agenda-tags - (org-global-tags-completion-table - (org-agenda-files))))))) + ;; Uniquify tags in alists, yet preserve + ;; structure (i.e., keywords). + (delq nil + (mapcar + (lambda (pair) + (let ((head (car pair))) + (cond ((symbolp head) pair) + ((member head seen) nil) + (t (push head seen) + pair)))) + (append + org-tag-persistent-alist + (or org-tag-alist (org-get-buffer-tags)) + (and + org-complete-tags-always-offer-all-agenda-tags + (org-global-tags-completion-table + (org-agenda-files)))))))) (current-tags (org-split-string current ":")) (inherited-tags (nreverse (nthcdr (length current-tags) -- 2.11.4.GIT