mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Backward compatibility with pre-existing struct instances.
* lisp/emacs-lisp/cl-lib.el (cl--old-struct-type-of): New function. (cl-old-struct-compat-mode): New minor mode. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Pass `record' to cl-struct-define to signal use of record objects. * lisp/emacs-lisp/cl-preloaded.el (cl--struct-get-class, cl-struct-define): Enable legacy defstruct compatibility. * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-old-struct, old-struct): New tests. * doc/lispref/elisp.texi, doc/lispref/records.texi: Document `old-struct-compat'.
This commit is contained in:
parent
b6738682ae
commit
2c68192c6b
6 changed files with 84 additions and 3 deletions
|
|
@ -110,6 +110,12 @@
|
|||
;;;###autoload
|
||||
(defun cl-struct-define (name docstring parent type named slots children-sym
|
||||
tag print)
|
||||
(unless type
|
||||
;; Legacy defstruct, using tagged vectors. Enable backward compatibility.
|
||||
(cl-old-struct-compat-mode 1))
|
||||
(if (eq type 'record)
|
||||
;; Defstruct using record objects.
|
||||
(setq type nil))
|
||||
(cl-assert (or type (not named)))
|
||||
(if (boundp children-sym)
|
||||
(add-to-list children-sym tag)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue