Elisp: Symbol Property List

By Xah Lee. Date: .

Each lisp symbol is associated with a “property list”.

[see Elisp: Property List]

This property list is stored in the symbol's property list cell. [see Elisp: Lisp Symbol]

Emacs lisp 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.

Accessing Symbol's Property List

Here's most useful functions to access symbol's property list:

;; set the value of key xx, of symbol ff's property list
(put 'ff 'xx 5)
;; get the value of key xx, of symbol ff's property list
(get 'ff 'xx) ; nil
;; get the value of symbol ff's property list
(symbol-plist 'ff )

;; set the value of symbol ff's property list
(setplist 'ff '(a 1 b 2))

(info "(elisp) Symbol Properties")

See also Elisp: Property List

Examples of Using Symbol Properties

Elisp Data Structure

  1. Sequence: List, Array
  2. Vector
  3. List
  4. Sequence Functions
  5. Map List/Vector
  6. Exit Loop/Function
  7. Association List
  8. Property List
  9. Symbol Property List
  10. Hash Table
Patreon me $5 patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

If you have a question, put $5 at patreon and message me.