Elisp: Symbol Property List
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
toggle-letter-case
at Emacs's Letter-Case Changing Commandscycle-hyphen-underscore-space
at Cycle Replace Space Hyphen Underscore
Data Structure Topic
Patreon me $5. Ask me question on patreon