4

There's no built-in setter for plist-get. Example:

(let ((pl '(:what (one))))
  (push 'two (plist-get pl :what))
  pl)

Error: let*: Symbol’s function definition is void: \(setf\ plist-get\)

How can I make setf work with plist-get?

Drew
  • 75,699
  • 9
  • 109
  • 225
user3496846
  • 378
  • 1
  • 10

1 Answers1

6

It's trivial to define your own:

(gv-define-simple-setter plist-get plist-put)

(let ((pl '(:what (one))))
  (push 'two (plist-get pl :what))
  pl) ; => (:what (two one))

You can find more examples in gv.el.

wasamasa
  • 21,803
  • 1
  • 65
  • 97