]> git.eshelyaron.com Git - emacs.git/commit
eieio-core.el: Make slot-value work on defstructs
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 31 Oct 2021 14:57:44 +0000 (10:57 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 31 Oct 2021 14:58:43 +0000 (10:58 -0400)
commitd553e603f405acb06ad9ea233543ebe6ce319210
tree679f835c197742e32b222ea59af69d55b20673cb
parentc062c9d4db0ed5d9a1bc45696ae660234d37d1cf
eieio-core.el: Make slot-value work on defstructs

Adjust the values in EIEIO's index-tables so they are compatible with those
of defstructs.

* lisp/emacs-lisp/eieio-core.el (eieio--slot-name-index): Don't add the
`eieio--object-num-slots` offset.
(eieio-defclass-internal): Add the `eieio--object-num-slots` offset
here instead.
(eieio-oref): Allow its use on `cl-structure-object`.

* lisp/emacs-lisp/eieio.el (eieio-pcase-slot-index-from-index-table):
Don't need to add the `eieio--object-num-slots` offset.

* doc/misc/eieio.texi (Accessing Slots, Accessing Slots):
Mention the use on structs.

* test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
(eieio-test-defstruct-slot-value): New test.
doc/misc/eieio.texi
etc/NEWS
lisp/emacs-lisp/eieio-core.el
lisp/emacs-lisp/eieio.el
test/lisp/emacs-lisp/eieio-tests/eieio-tests.el