mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-10 00:00:39 -08:00
Cleanup some of EIEIO's namespace.
* lisp/emacs-lisp/eieio.el (eieio--define-field-accessors): New macro. Use it to define all the class-* and object-* field accessors (renamed to eieio--class-* and eieio--object-*). Update all uses. (eieio--class-num-slots, eieio--object-num-slots): Rename from class-num-slots and object-num-slots. (eieio--check-type): New macro. (eieio-defclass, eieio-oref, eieio-oref-default, same-class-p) (object-of-class-p, child-of-class-p, object-slots, class-slot-initarg) (eieio-oset, eieio-oset-default, object-assoc, object-assoc-list) (object-assoc-list-safe): Use it. (eieio-defclass): Tighten regexp. (eieio--defmethod): Use `memq'. Signal an error for unknown method kind. Remove unreachable code. (object-class-fast): Declare obsolete. (eieio-class-name, eieio-object-name, eieio-object-set-name-string) (eieio-object-class, eieio-object-class-name, eieio-class-parents) (eieio-class-children, eieio-class-precedence-list, eieio-class-parent): Rename from class-name, object-name, object-set-name-string, object-class, object-class-name, class-parents, class-children, class-precedence-list, class-parent; with obsolete alias. (class-of, class-direct-superclasses, class-direct-subclasses): Declare obsolete. (eieio-defmethod): Use `memq'; remove unreachable code. * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-opt.el (eieio-class-button, eieio-describe-generic) (eieio-browse-tree, eieio-browse): Use eieio--check-type.
This commit is contained in:
parent
6a0fda530d
commit
8ca4f1e02e
7 changed files with 441 additions and 391 deletions
|
|
@ -58,9 +58,9 @@ PREBUTTONTEXT is some text between PREFIX and the object button."
|
|||
(end nil)
|
||||
(str (object-print object))
|
||||
(tip (format "Object %s\nClass: %S\nParent(s): %S\n%d slots"
|
||||
(object-name-string object)
|
||||
(object-class object)
|
||||
(class-parents (object-class object))
|
||||
(eieio-object-name-string object)
|
||||
(eieio-object-class object)
|
||||
(eieio-class-parents (eieio-object-class object))
|
||||
(length (object-slots object))
|
||||
))
|
||||
)
|
||||
|
|
@ -82,16 +82,16 @@ PREBUTTONTEXT is some text between PREFIX and the object button."
|
|||
(defmethod data-debug/eieio-insert-slots ((obj eieio-default-superclass)
|
||||
prefix)
|
||||
"Insert the slots of OBJ into the current DDEBUG buffer."
|
||||
(data-debug-insert-thing (object-name-string obj)
|
||||
(data-debug-insert-thing (eieio-object-name-string obj)
|
||||
prefix
|
||||
"Name: ")
|
||||
(let* ((cl (object-class obj))
|
||||
(let* ((cl (eieio-object-class obj))
|
||||
(cv (class-v cl)))
|
||||
(data-debug-insert-thing (class-constructor cl)
|
||||
prefix
|
||||
"Class: ")
|
||||
;; Loop over all the public slots
|
||||
(let ((publa (aref cv class-public-a))
|
||||
(let ((publa (eieio--class-public-a cv))
|
||||
)
|
||||
(while publa
|
||||
(if (slot-boundp obj (car publa))
|
||||
|
|
@ -123,7 +123,7 @@ PREBUTTONTEXT is some text between PREFIX and the object button."
|
|||
;;
|
||||
(defmethod data-debug-show ((obj eieio-default-superclass))
|
||||
"Run ddebug against any EIEIO object OBJ."
|
||||
(data-debug-new-buffer (format "*%s DDEBUG*" (object-name obj)))
|
||||
(data-debug-new-buffer (format "*%s DDEBUG*" (eieio-object-name obj)))
|
||||
(data-debug-insert-object-slots obj "]"))
|
||||
|
||||
;;; DEBUG FUNCTIONS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue