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 <math.semantic.web@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/106763>
This commit is contained in:
Nicolas Goaziou 2016-04-28 22:04:49 +02:00
parent e818699113
commit c8c2d2b1f7
1 changed files with 19 additions and 9 deletions

View File

@ -15016,17 +15016,27 @@ When JUST-ALIGN is non-nil, only align tags."
(if just-align current (if just-align current
;; Get a new set of tags from the user. ;; Get a new set of tags from the user.
(save-excursion (save-excursion
(let* ((table (let* ((seen)
(table
(setq (setq
org-last-tags-completion-table org-last-tags-completion-table
(delete-dups ;; 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 (append
org-tag-persistent-alist org-tag-persistent-alist
(or org-tag-alist (org-get-buffer-tags)) (or org-tag-alist (org-get-buffer-tags))
(and (and
org-complete-tags-always-offer-all-agenda-tags org-complete-tags-always-offer-all-agenda-tags
(org-global-tags-completion-table (org-global-tags-completion-table
(org-agenda-files))))))) (org-agenda-files))))))))
(current-tags (org-split-string current ":")) (current-tags (org-split-string current ":"))
(inherited-tags (inherited-tags
(nreverse (nthcdr (length current-tags) (nreverse (nthcdr (length current-tags)