Function: org-tag-alist-to-groups

org-tag-alist-to-groups is a byte-compiled function defined in org.el.gz.

Signature

(org-tag-alist-to-groups ALIST)

Documentation

Return group alist from tag ALIST.

ALIST is an alist, as defined in org-tag-alist or org-tag-persistent-alist, or produced with org-tag-string-to-alist. Return value is an alist following the pattern (GROUP-TAG TAGS) where GROUP-TAG is the tag, as a string, summarizing TAGS, as a list of strings.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-tag-alist-to-groups (alist)
  "Return group alist from tag ALIST.
ALIST is an alist, as defined in `org-tag-alist' or
`org-tag-persistent-alist', or produced with
`org-tag-string-to-alist'.  Return value is an alist following
the pattern (GROUP-TAG TAGS) where GROUP-TAG is the tag, as
a string, summarizing TAGS, as a list of strings."
  (let (groups group-status current-group)
    (dolist (token alist (nreverse groups))
      (pcase token
	(`(,(or :startgroup :startgrouptag)) (setq group-status t))
	(`(,(or :endgroup :endgrouptag))
	 (when (eq group-status 'append)
	   (push (nreverse current-group) groups))
	 (setq group-status nil current-group nil))
	(`(:grouptags) (setq group-status 'append))
	((and `(,tag . ,_) (guard group-status))
	 (if (eq group-status 'append) (push tag current-group)
	   (setq current-group (list tag))))
	(_ nil)))))