Function: object-assoc

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

Signature

(object-assoc KEY SLOT LIST)

Documentation

Return an object if KEY is equal to SLOT's value of an object in LIST.

LIST is a list of objects whose slots are searched. Objects in LIST do not need to have a slot named SLOT, nor does SLOT need to be bound. If these errors occur, those objects will be ignored.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio.el.gz
;;; Slightly more complex utility functions for objects
;;
(defun object-assoc (key slot list)
  "Return an object if KEY is `equal' to SLOT's value of an object in LIST.
LIST is a list of objects whose slots are searched.
Objects in LIST do not need to have a slot named SLOT, nor does
SLOT need to be bound.  If these errors occur, those objects will
be ignored."
  (cl-check-type list list)
  (while (and list (not (condition-case nil
			    ;; This prevents errors for missing slots.
			    (equal key (eieio-oref (car list) slot))
			  (error nil))))
    (setq list (cdr list)))
  (car list))