Function: TeX-add-to-alist
TeX-add-to-alist is a byte-compiled function defined in tex.el.
Signature
(TeX-add-to-alist ALIST-VAR NEW-ALIST)
Documentation
Add NEW-ALIST to the ALIST-VAR.
If an element with the same key as the key of an element of NEW-ALIST is already present in ALIST-VAR, add the new values to it; if a matching element is not already present, append the new element to ALIST-VAR.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-add-to-alist (alist-var new-alist)
"Add NEW-ALIST to the ALIST-VAR.
If an element with the same key as the key of an element of
NEW-ALIST is already present in ALIST-VAR, add the new values to
it; if a matching element is not already present, append the new
element to ALIST-VAR."
;; Loop over all elements of NEW-ALIST.
(while new-alist
(let* ((new-element (car new-alist))
;; Get the element of ALIST-VAR with the same key of the current
;; element of NEW-ALIST, if any.
(old-element (assoc (car new-element) (symbol-value alist-var))))
(if old-element
(progn
(set alist-var (delete old-element (symbol-value alist-var)))
;; Append to `old-element' the values of the current element of
;; NEW-ALIST.
(mapc (lambda (elt)
(unless (member elt (cdr old-element))
(setq old-element (append old-element (list elt)))))
(cdr new-element))
(add-to-list alist-var old-element t))
(add-to-list alist-var new-element t)))
;; Next element of NEW-ALIST.
(setq new-alist (cdr new-alist))))