Emacs Lisp: Symbol Property List
Each lisp symbol is associated with a Property List .
This property list is stored in the Symbol's property list cell.
Symbol Property List is used extensively in emacs. It is also very useful if you want to write a function with state. You can store the state info with the symbol itself, instead of using a global variable.
Set Whole Plist
(setplist SYMBOL NEWPLIST)
Set SYMBOL's property list to NEWPLIST, and return NEWPLIST.
(setplist 'ff '(a 1 b 2))
Get Whole Plist
Return SYMBOL's property list.
Add/Set a Key
(put SYMBOL PROPNAME VALUE)
Store SYMBOL's PROPNAME property with value VALUE.
;; set the value of key xx, of symbol ff's property list (put 'ff 'xx 5)
Get a Key's Value
(get SYMBOL PROPNAME)
Return the value of SYMBOL's PROPNAME property.
;; get the value of key xx, of symbol ff's property list (get 'ff 'xx)
Example of Using Symbol Properties
Emacs Lisp: How to Write a Toggle Command
(info "(elisp) Symbol Properties")