Symbols Symbols Creating Symbols
These functions augment the standard Emacs Lisp functions
put for operating on properties attached to symbols.
There are also functions for working with property lists as
first-class data structures not attached to particular symbols.
get, except that if the property is not found, the default argument provides the return value. (The Emacs Lisp
getfunction always uses
nilas the default; this package's
get*is equivalent to Common Lisp's
get* function is
setf-able; when used in this
fashion, the default argument is allowed but ignored.
nilif there was no such property. (This function was probably omitted from Emacs originally because, since
getdid not allow a default, it was very difficult to distinguish between a missing property and a property whose value was
nil; thus, setting a property to
nilwas close enough to
rempropfor most purposes.)
eqto property, the following odd-numbered element is returned. Otherwise, default is returned (or
nilif no default is given).
(get sym prop) == (getf (symbol-plist sym) prop)
It is legal to use
getf as a
setf place, in which case
its place argument must itself be a legal
The default argument, if any, is ignored in this context.
The effect is to change (via
setcar) the value cell in the
list that corresponds to property, or to cons a new property-value
pair onto the list if the property is not yet present.
(put sym prop val) == (setf (getf (symbol-plist sym) prop) val)
get* functions are also
The fact that
default is ignored can sometimes be useful:
(incf (get* 'foo 'usage-count 0))
usage-count property is incremented
if it exists, or set to 1 (an incremented 0) otherwise.
When not used as a
getf is just a regular
function and its place argument can actually be any Lisp
setf-able place expression. It returns true if the property was found. Note that if property happens to be first on the list, this will effectively do a
(setf place (cddr place)), whereas if it occurs later, this simply uses
setcdrto splice out the property and value cells.