Function: object-assoc-list-safe

object-assoc-list-safe is a byte-compiled function defined in eieio.el.gz.

Signature

(object-assoc-list-safe SLOT LIST)

Documentation

Return an association list with the contents of SLOT as the key element.

LIST must be a list of objects, but those objects do not need to have SLOT in it. If it does not, then that element is left out of the association list.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio.el.gz
(defun object-assoc-list-safe (slot list)
  "Return an association list with the contents of SLOT as the key element.
LIST must be a list of objects, but those objects do not need to have
SLOT in it.  If it does not, then that element is left out of the association
list."
  (cl-check-type list list)
  (let ((assoclist nil))
    (while list
      (if (slot-exists-p (car list) slot)
	  (setq assoclist (cons (cons (eieio-oref (car list) slot)
				      (car list))
				assoclist)))
      (setq list (cdr list)))
    (nreverse assoclist)))