]> git.eshelyaron.com Git - emacs.git/commit
Add cl-with-accessors
authorEarl Hyatt <okamsn@protonmail.com>
Thu, 13 Mar 2025 03:01:49 +0000 (23:01 -0400)
committerEshel Yaron <me@eshelyaron.com>
Thu, 3 Apr 2025 16:49:13 +0000 (18:49 +0200)
commit6e4ef6931e9067ea22fa016750424022bef6225d
tree31382f9404a60b138b7a430a15d4fd79c14346b7
parent3a8e6eee05149611dd506181de2242d613995ac5
Add cl-with-accessors

* lisp/emacs-lisp/cl-macs.el (cl-with-accessors): New macro.
* doc/misc/cl.texi (Structures): Mention the new macro.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-struct-with-accessors):
New Test.
* etc/NEWS (New macro 'cl-with-accessors'.): Mention the macro.

This macro is useful when making repeated use of a structures accessor
functions, such as reading from a slot and then writing to a slot.  It
is similar to 'with-slots' from EIEIO, but uses accessor functions
instead of slot names.

(cherry picked from commit e04d1dafc700813c835ae4e45af4e104c49e8875)
doc/misc/cl.texi
lisp/emacs-lisp/cl-macs.el
test/lisp/emacs-lisp/cl-macs-tests.el