From a0010db41ca83a8211162b649e679162dd4153a6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 2 Jul 2015 10:59:32 -0400 Subject: * lisp/emacs-lisp/eieio-core.el (eieio--class-v): Remove * lisp/emacs-lisp/eieio-core.el, lisp/emacs-lisp/eieio.el, lisp/emacs-lisp/eieio-opt.el, lisp/emacs-lisp/eieio-compat.el: Use cl--find-class instead. --- lisp/emacs-lisp/eieio-compat.el | 2 +- lisp/emacs-lisp/eieio-core.el | 32 ++++++++++++++------------------ lisp/emacs-lisp/eieio-opt.el | 12 ++++++------ lisp/emacs-lisp/eieio.el | 10 +++++----- 4 files changed, 26 insertions(+), 30 deletions(-) diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el index 0283704e033..386ff2f7449 100644 --- a/lisp/emacs-lisp/eieio-compat.el +++ b/lisp/emacs-lisp/eieio-compat.el @@ -138,7 +138,7 @@ Summary: (cl-generic-make-generalizer ;; Give it a slightly higher priority than `subclass' so that the ;; interleaved list comes before subclass's non-interleaved list. - 61 (lambda (name) `(and (symbolp ,name) (eieio--class-v ,name))) + 61 (lambda (name) `(and (symbolp ,name) (cl--find-class ,name))) #'eieio--generic-static-symbol-specializers)) (defconst eieio--generic-static-object-generalizer (cl-generic-make-generalizer diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index bf3f44206c4..8a09f071e2e 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -126,23 +126,19 @@ Currently under control of this var: ;;; Important macros used internally in eieio. -(defmacro eieio--class-v (class) ;Use a macro, so it acts as a GV place. - "Internal: Return the class vector from the CLASS symbol." - (declare (debug t)) - ;; No check: If eieio gets this far, it has probably been checked already. - `(get ,class 'eieio-class-definition)) +(require 'cl-macs) ;For cl--find-class. (defsubst eieio--class-object (class) "Return the class object." (if (symbolp class) ;; Keep the symbol if class-v is nil, for better error messages. - (or (eieio--class-v class) class) + (or (cl--find-class class) class) class)) (defun class-p (class) "Return non-nil if CLASS is a valid class vector. CLASS is a symbol." ;FIXME: Is it a vector or a symbol? - (and (symbolp class) (eieio--class-p (eieio--class-v class)))) + (and (symbolp class) (eieio--class-p (cl--find-class class)))) (defun eieio--class-print-name (class) "Return a printed representation of CLASS." @@ -182,7 +178,7 @@ Return nil if that option doesn't exist." (defun class-abstract-p (class) "Return non-nil if CLASS is abstract. Abstract classes cannot be instantiated." - (eieio--class-option (eieio--class-v class) :abstract)) + (eieio--class-option (cl--find-class class) :abstract)) (defsubst eieio--class-method-invocation-order (class) "Return the invocation order of CLASS. @@ -215,7 +211,7 @@ It creates an autoload function for CNAME's constructor." ;; simply not exist yet. So instead we just don't store the list of parents ;; here in eieio-defclass-autoload at all, since it seems that they're just ;; not needed before the class is actually loaded. - (let* ((oldc (eieio--class-v cname)) + (let* ((oldc (cl--find-class cname)) (newc (eieio--class-make cname))) (if (eieio--class-p oldc) nil ;; Do nothing if we already have this class. @@ -229,7 +225,7 @@ It creates an autoload function for CNAME's constructor." ;; do this first so that we can call defmethod for the accessor. ;; The vector will be updated by the following while loop and will not ;; need to be stored a second time. - (setf (eieio--class-v cname) newc) + (setf (cl--find-class cname) newc) ;; Create an autoload on top of our constructor function. (autoload cname filename doc nil nil) @@ -276,7 +272,7 @@ See `defclass' for more information." (run-hooks 'eieio-hook) (setq eieio-hook nil) - (let* ((oldc (let ((c (eieio--class-v cname))) (if (eieio--class-p c) c))) + (let* ((oldc (let ((c (cl--find-class cname))) (if (eieio--class-p c) c))) (newc (or oldc ;; Reuse `oldc' instead of creating a new one, so that ;; existing references stay valid. E.g. when @@ -312,7 +308,7 @@ See `defclass' for more information." (dolist (p superclasses) (if (not (and p (symbolp p))) (error "Invalid parent class %S" p) - (let ((c (eieio--class-v p))) + (let ((c (cl--find-class p))) (if (not (eieio--class-p c)) ;; bad class (error "Given parent class %S is not a class" p) @@ -371,7 +367,7 @@ See `defclass' for more information." ;; do this first so that we can call defmethod for the accessor. ;; The vector will be updated by the following while loop and will not ;; need to be stored a second time. - (setf (eieio--class-v cname) newc) + (setf (cl--find-class cname) newc) ;; Query each slot in the declaration list and mangle into the ;; class structure I have defined. @@ -731,7 +727,7 @@ Argument FN is the function calling this verifier." (cl-check-type obj (or eieio-object class)) (let* ((class (cond ((symbolp obj) (error "eieio-oref called on a class: %s" obj) - (let ((c (eieio--class-v obj))) + (let ((c (cl--find-class obj))) (if (eieio--class-p c) (eieio-class-un-autoload obj)) c)) (t (eieio--object-class obj)))) @@ -757,7 +753,7 @@ Argument FN is the function calling this verifier." Fills in OBJ's SLOT with its default value." (cl-check-type obj (or eieio-object class)) (cl-check-type slot symbol) - (let* ((cl (cond ((symbolp obj) (eieio--class-v obj)) + (let* ((cl (cond ((symbolp obj) (cl--find-class obj)) (t (eieio--object-class obj)))) (c (eieio--slot-name-index cl slot))) (if (not c) @@ -964,7 +960,7 @@ If a consistent order does not exist, signal an error." (defun eieio--class-precedence-c3 (class) "Return all parents of CLASS in c3 order." - (let ((parents (eieio--class-parents (eieio--class-v class)))) + (let ((parents (eieio--class-parents (cl--find-class class)))) (eieio--c3-merge-lists (list class) (append @@ -1084,14 +1080,14 @@ method invocation orders of the involved classes." (defconst eieio--generic-subclass-generalizer (cl-generic-make-generalizer - 60 (lambda (name) `(and (symbolp ,name) (eieio--class-v ,name))) + 60 (lambda (name) `(and (symbolp ,name) (cl--find-class ,name))) #'eieio--generic-subclass-specializers)) (cl-defmethod cl-generic-generalizers ((_specializer (head subclass))) (list eieio--generic-subclass-generalizer)) -;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "0609a7bdcd6f38876b7f5647047ddca9") +;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "ea8c7f24ed47c6b71ac37cbdae1c9931") ;;; Generated autoloads from eieio-compat.el (autoload 'eieio--defalias "eieio-compat" "\ diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index 6cd6813956a..f7dbdf5014b 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -60,7 +60,7 @@ Argument PREFIX is the character prefix to use. Argument CH-PREFIX is another character prefix to display." (cl-check-type this-root class) (let ((myname (symbol-name this-root)) - (chl (eieio--class-children (eieio--class-v this-root))) + (chl (eieio--class-children (cl--find-class this-root))) (fprefix (concat ch-prefix " +--")) (mprefix (concat ch-prefix " | ")) (lprefix (concat ch-prefix " "))) @@ -84,7 +84,7 @@ If CLASS is actually an object, then also display current values of that object. ;; Header line (prin1 class) (insert " is a" - (if (eieio--class-option (eieio--class-v class) :abstract) + (if (eieio--class-option (cl--find-class class) :abstract) "n abstract" "") " class") @@ -162,7 +162,7 @@ If CLASS is actually an object, then also display current values of that object. (defun eieio-help-class-slots (class) "Print help description for the slots in CLASS. Outputs to the current buffer." - (let* ((cv (eieio--class-v class)) + (let* ((cv (cl--find-class class)) (slots (eieio--class-slots cv)) (cslots (eieio--class-class-slots cv))) (insert (propertize "Instance Allocated Slots:\n\n" @@ -181,7 +181,7 @@ If INSTANTIABLE-ONLY is non nil, only allow names of classes which are not abstract, otherwise allow all classes. Optional argument BUILDLIST is more list to attach and is used internally." (let* ((cc (or class 'eieio-default-superclass)) - (sublst (eieio--class-children (eieio--class-v cc)))) + (sublst (eieio--class-children (cl--find-class cc)))) (unless (assoc (symbol-name cc) buildlist) (when (or (not instantiable-only) (not (class-abstract-p cc))) ;; FIXME: Completion tables don't need alists, and ede/generic.el needs @@ -452,7 +452,7 @@ current expansion depth." (defun eieio-class-button (class depth) "Draw a speedbar button at the current point for CLASS at DEPTH." (cl-check-type class class) - (let ((subclasses (eieio--class-children (eieio--class-v class)))) + (let ((subclasses (eieio--class-children (cl--find-class class)))) (if subclasses (speedbar-make-tag-line 'angle ?+ 'eieio-sb-expand @@ -477,7 +477,7 @@ Argument INDENT is the depth of indentation." (speedbar-with-writable (save-excursion (end-of-line) (forward-char 1) - (let ((subclasses (eieio--class-children (eieio--class-v class)))) + (let ((subclasses (eieio--class-children (cl--find-class class)))) (while subclasses (eieio-class-button (car subclasses) (1+ indent)) (setq subclasses (cdr subclasses))))))) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 662bc0a6dd4..eee848f7869 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -435,7 +435,7 @@ The CLOS function `class-direct-superclasses' is aliased to this function." "Return child classes to CLASS. The CLOS function `class-direct-subclasses' is aliased to this function." (cl-check-type class class) - (eieio--class-children (eieio--class-v class))) + (eieio--class-children (cl--find-class class))) (define-obsolete-function-alias 'class-children #'eieio-class-children "24.4") @@ -566,7 +566,7 @@ OBJECT can be an instance or a class." "Return the class that SYMBOL represents. If there is no class, nil is returned if ERRORP is nil. If ERRORP is non-nil, `wrong-argument-type' is signaled." - (let ((class (eieio--class-v symbol))) + (let ((class (cl--find-class symbol))) (cond ((eieio--class-p class) class) (errorp (signal 'wrong-type-argument (list 'class-p symbol)))))) @@ -672,7 +672,7 @@ Its slots are automatically adopted by classes with no specified parents. This class is not stored in the `parent' slot of a class vector." :abstract t) -(setq eieio-default-superclass (eieio--class-v 'eieio-default-superclass)) +(setq eieio-default-superclass (cl--find-class 'eieio-default-superclass)) (defalias 'standard-class 'eieio-default-superclass) @@ -862,7 +862,7 @@ this object." (princ comment) (princ "\n")) (let* ((cl (eieio-object-class this)) - (cv (eieio--class-v cl))) + (cv (cl--find-class cl))) ;; Now output readable lisp to recreate this object ;; It should look like this: ;; ( ... ) @@ -978,7 +978,7 @@ Optional argument GROUP is the sub-group of slots to display. ;;;*** -;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "899e10c7883c4aac5cefcc223794e8f9") +;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "b7995d9076e4dd4b9358b2aa66835619") ;;; Generated autoloads from eieio-opt.el (autoload 'eieio-browse "eieio-opt" "\ -- cgit v1.2.1