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

Data Structure Topic

  1. Elisp: Sequence: List, Array
  2. Elisp: Vector
  3. Elisp: List
  4. Elisp: Association List
  5. Elisp: Property List
  6. Elisp: Symbol Property List
  7. Elisp: Map / Loop Thru List / Vector
  8. Elisp: Filter a List
  9. Elisp: Hash Table
Like it? Buy Xah Emacs Tutorial. Thanks.