Function: org--add-or-remove-tag

org--add-or-remove-tag is a byte-compiled function defined in org.el.gz.

Signature

(org--add-or-remove-tag TAG CURRENT-TAGS &optional GROUPS)

Documentation

Add or remove TAG entered by user to/from CURRENT-TAGS.

Return the modified CURRENT-TAGS.

When TAG is present in CURRENT-TAGS, remove it. Otherwise, add it. When TAG is a part of a tag group from GROUPS, make sure that no exclusive tags from the same group remain in CURRENT-TAGS.

CURRENT-TAGS may be modified by side effect.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--add-or-remove-tag (tag current-tags &optional groups)
  "Add or remove TAG entered by user to/from CURRENT-TAGS.
Return the modified CURRENT-TAGS.

When TAG is present in CURRENT-TAGS, remove it.  Otherwise, add it.
When TAG is a part of a tag group from GROUPS, make sure that no
exclusive tags from the same group remain in CURRENT-TAGS.

CURRENT-TAGS may be modified by side effect."
  (if (member tag current-tags)
      ;; Remove the tag.
      (delete tag current-tags)
    ;; Add the tag.  If the tag is from a tag
    ;; group, exclude selected alternative tags
    ;; from the group, if any.
    (dolist (g groups)
      (when (member tag g)
	(dolist (x g) (setq current-tags (delete x current-tags)))))
    (cons tag current-tags)))