Function: plist-get

plist-get is a function defined in fns.c.

Signature

(plist-get PLIST PROP)

Documentation

Extract a value from a property list.

PLIST is a property list, which is a list of the form
(PROP1 VALUE1 PROP2 VALUE2...).

This function returns the value corresponding to the given PROP, or nil if PROP is not one of the properties on the list. The comparison with PROP is done using eq.

This function never signals an error.

Other relevant functions are documented in the list group.

Probably introduced at or before Emacs version 19.29.

Shortdoc

;; list
(plist-get '(a 1 b 2 c 3) 'b)
    => 2

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  Lisp_Object tail = plist;
  FOR_EACH_TAIL_SAFE (tail)
    {
      if (! CONSP (XCDR (tail)))
	break;
      if (EQ (prop, XCAR (tail)))
	return XCAR (XCDR (tail));
      tail = XCDR (tail);
    }

  return Qnil;
}