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

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

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

How can I make setf work with plist-get?

  • 1
    Good question, and good answer @wasamasa.
    – Drew
    Jun 28 '20 at 15:59

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.