aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2015-07-02 10:59:32 -0400
committerStefan Monnier2015-07-02 10:59:32 -0400
commita0010db41ca83a8211162b649e679162dd4153a6 (patch)
tree3b84c25d12d8db1bd8c91ea136fb834e1bc7ba3e /lisp
parent8bab1490f14207eeeee4b2f4ad30b5d695db8245 (diff)
downloademacs-a0010db41ca83a8211162b649e679162dd4153a6.tar.gz
emacs-a0010db41ca83a8211162b649e679162dd4153a6.zip
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/eieio-compat.el2
-rw-r--r--lisp/emacs-lisp/eieio-core.el32
-rw-r--r--lisp/emacs-lisp/eieio-opt.el12
-rw-r--r--lisp/emacs-lisp/eieio.el10
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:
138 (cl-generic-make-generalizer 138 (cl-generic-make-generalizer
139 ;; Give it a slightly higher priority than `subclass' so that the 139 ;; Give it a slightly higher priority than `subclass' so that the
140 ;; interleaved list comes before subclass's non-interleaved list. 140 ;; interleaved list comes before subclass's non-interleaved list.
141 61 (lambda (name) `(and (symbolp ,name) (eieio--class-v ,name))) 141 61 (lambda (name) `(and (symbolp ,name) (cl--find-class ,name)))
142 #'eieio--generic-static-symbol-specializers)) 142 #'eieio--generic-static-symbol-specializers))
143(defconst eieio--generic-static-object-generalizer 143(defconst eieio--generic-static-object-generalizer
144 (cl-generic-make-generalizer 144 (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:
126 126
127;;; Important macros used internally in eieio. 127;;; Important macros used internally in eieio.
128 128
129(defmacro eieio--class-v (class) ;Use a macro, so it acts as a GV place. 129(require 'cl-macs) ;For cl--find-class.
130 "Internal: Return the class vector from the CLASS symbol."
131 (declare (debug t))
132 ;; No check: If eieio gets this far, it has probably been checked already.
133 `(get ,class 'eieio-class-definition))
134 130
135(defsubst eieio--class-object (class) 131(defsubst eieio--class-object (class)
136 "Return the class object." 132 "Return the class object."
137 (if (symbolp class) 133 (if (symbolp class)
138 ;; Keep the symbol if class-v is nil, for better error messages. 134 ;; Keep the symbol if class-v is nil, for better error messages.
139 (or (eieio--class-v class) class) 135 (or (cl--find-class class) class)
140 class)) 136 class))
141 137
142(defun class-p (class) 138(defun class-p (class)
143 "Return non-nil if CLASS is a valid class vector. 139 "Return non-nil if CLASS is a valid class vector.
144CLASS is a symbol." ;FIXME: Is it a vector or a symbol? 140CLASS is a symbol." ;FIXME: Is it a vector or a symbol?
145 (and (symbolp class) (eieio--class-p (eieio--class-v class)))) 141 (and (symbolp class) (eieio--class-p (cl--find-class class))))
146 142
147(defun eieio--class-print-name (class) 143(defun eieio--class-print-name (class)
148 "Return a printed representation of CLASS." 144 "Return a printed representation of CLASS."
@@ -182,7 +178,7 @@ Return nil if that option doesn't exist."
182(defun class-abstract-p (class) 178(defun class-abstract-p (class)
183 "Return non-nil if CLASS is abstract. 179 "Return non-nil if CLASS is abstract.
184Abstract classes cannot be instantiated." 180Abstract classes cannot be instantiated."
185 (eieio--class-option (eieio--class-v class) :abstract)) 181 (eieio--class-option (cl--find-class class) :abstract))
186 182
187(defsubst eieio--class-method-invocation-order (class) 183(defsubst eieio--class-method-invocation-order (class)
188 "Return the invocation order of CLASS. 184 "Return the invocation order of CLASS.
@@ -215,7 +211,7 @@ It creates an autoload function for CNAME's constructor."
215 ;; simply not exist yet. So instead we just don't store the list of parents 211 ;; simply not exist yet. So instead we just don't store the list of parents
216 ;; here in eieio-defclass-autoload at all, since it seems that they're just 212 ;; here in eieio-defclass-autoload at all, since it seems that they're just
217 ;; not needed before the class is actually loaded. 213 ;; not needed before the class is actually loaded.
218 (let* ((oldc (eieio--class-v cname)) 214 (let* ((oldc (cl--find-class cname))
219 (newc (eieio--class-make cname))) 215 (newc (eieio--class-make cname)))
220 (if (eieio--class-p oldc) 216 (if (eieio--class-p oldc)
221 nil ;; Do nothing if we already have this class. 217 nil ;; Do nothing if we already have this class.
@@ -229,7 +225,7 @@ It creates an autoload function for CNAME's constructor."
229 ;; do this first so that we can call defmethod for the accessor. 225 ;; do this first so that we can call defmethod for the accessor.
230 ;; The vector will be updated by the following while loop and will not 226 ;; The vector will be updated by the following while loop and will not
231 ;; need to be stored a second time. 227 ;; need to be stored a second time.
232 (setf (eieio--class-v cname) newc) 228 (setf (cl--find-class cname) newc)
233 229
234 ;; Create an autoload on top of our constructor function. 230 ;; Create an autoload on top of our constructor function.
235 (autoload cname filename doc nil nil) 231 (autoload cname filename doc nil nil)
@@ -276,7 +272,7 @@ See `defclass' for more information."
276 (run-hooks 'eieio-hook) 272 (run-hooks 'eieio-hook)
277 (setq eieio-hook nil) 273 (setq eieio-hook nil)
278 274
279 (let* ((oldc (let ((c (eieio--class-v cname))) (if (eieio--class-p c) c))) 275 (let* ((oldc (let ((c (cl--find-class cname))) (if (eieio--class-p c) c)))
280 (newc (or oldc 276 (newc (or oldc
281 ;; Reuse `oldc' instead of creating a new one, so that 277 ;; Reuse `oldc' instead of creating a new one, so that
282 ;; existing references stay valid. E.g. when 278 ;; existing references stay valid. E.g. when
@@ -312,7 +308,7 @@ See `defclass' for more information."
312 (dolist (p superclasses) 308 (dolist (p superclasses)
313 (if (not (and p (symbolp p))) 309 (if (not (and p (symbolp p)))
314 (error "Invalid parent class %S" p) 310 (error "Invalid parent class %S" p)
315 (let ((c (eieio--class-v p))) 311 (let ((c (cl--find-class p)))
316 (if (not (eieio--class-p c)) 312 (if (not (eieio--class-p c))
317 ;; bad class 313 ;; bad class
318 (error "Given parent class %S is not a class" p) 314 (error "Given parent class %S is not a class" p)
@@ -371,7 +367,7 @@ See `defclass' for more information."
371 ;; do this first so that we can call defmethod for the accessor. 367 ;; do this first so that we can call defmethod for the accessor.
372 ;; The vector will be updated by the following while loop and will not 368 ;; The vector will be updated by the following while loop and will not
373 ;; need to be stored a second time. 369 ;; need to be stored a second time.
374 (setf (eieio--class-v cname) newc) 370 (setf (cl--find-class cname) newc)
375 371
376 ;; Query each slot in the declaration list and mangle into the 372 ;; Query each slot in the declaration list and mangle into the
377 ;; class structure I have defined. 373 ;; class structure I have defined.
@@ -731,7 +727,7 @@ Argument FN is the function calling this verifier."
731 (cl-check-type obj (or eieio-object class)) 727 (cl-check-type obj (or eieio-object class))
732 (let* ((class (cond ((symbolp obj) 728 (let* ((class (cond ((symbolp obj)
733 (error "eieio-oref called on a class: %s" obj) 729 (error "eieio-oref called on a class: %s" obj)
734 (let ((c (eieio--class-v obj))) 730 (let ((c (cl--find-class obj)))
735 (if (eieio--class-p c) (eieio-class-un-autoload obj)) 731 (if (eieio--class-p c) (eieio-class-un-autoload obj))
736 c)) 732 c))
737 (t (eieio--object-class obj)))) 733 (t (eieio--object-class obj))))
@@ -757,7 +753,7 @@ Argument FN is the function calling this verifier."
757Fills in OBJ's SLOT with its default value." 753Fills in OBJ's SLOT with its default value."
758 (cl-check-type obj (or eieio-object class)) 754 (cl-check-type obj (or eieio-object class))
759 (cl-check-type slot symbol) 755 (cl-check-type slot symbol)
760 (let* ((cl (cond ((symbolp obj) (eieio--class-v obj)) 756 (let* ((cl (cond ((symbolp obj) (cl--find-class obj))
761 (t (eieio--object-class obj)))) 757 (t (eieio--object-class obj))))
762 (c (eieio--slot-name-index cl slot))) 758 (c (eieio--slot-name-index cl slot)))
763 (if (not c) 759 (if (not c)
@@ -964,7 +960,7 @@ If a consistent order does not exist, signal an error."
964 960
965(defun eieio--class-precedence-c3 (class) 961(defun eieio--class-precedence-c3 (class)
966 "Return all parents of CLASS in c3 order." 962 "Return all parents of CLASS in c3 order."
967 (let ((parents (eieio--class-parents (eieio--class-v class)))) 963 (let ((parents (eieio--class-parents (cl--find-class class))))
968 (eieio--c3-merge-lists 964 (eieio--c3-merge-lists
969 (list class) 965 (list class)
970 (append 966 (append
@@ -1084,14 +1080,14 @@ method invocation orders of the involved classes."
1084 1080
1085(defconst eieio--generic-subclass-generalizer 1081(defconst eieio--generic-subclass-generalizer
1086 (cl-generic-make-generalizer 1082 (cl-generic-make-generalizer
1087 60 (lambda (name) `(and (symbolp ,name) (eieio--class-v ,name))) 1083 60 (lambda (name) `(and (symbolp ,name) (cl--find-class ,name)))
1088 #'eieio--generic-subclass-specializers)) 1084 #'eieio--generic-subclass-specializers))
1089 1085
1090(cl-defmethod cl-generic-generalizers ((_specializer (head subclass))) 1086(cl-defmethod cl-generic-generalizers ((_specializer (head subclass)))
1091 (list eieio--generic-subclass-generalizer)) 1087 (list eieio--generic-subclass-generalizer))
1092 1088
1093 1089
1094;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "0609a7bdcd6f38876b7f5647047ddca9") 1090;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "ea8c7f24ed47c6b71ac37cbdae1c9931")
1095;;; Generated autoloads from eieio-compat.el 1091;;; Generated autoloads from eieio-compat.el
1096 1092
1097(autoload 'eieio--defalias "eieio-compat" "\ 1093(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.
60Argument CH-PREFIX is another character prefix to display." 60Argument CH-PREFIX is another character prefix to display."
61 (cl-check-type this-root class) 61 (cl-check-type this-root class)
62 (let ((myname (symbol-name this-root)) 62 (let ((myname (symbol-name this-root))
63 (chl (eieio--class-children (eieio--class-v this-root))) 63 (chl (eieio--class-children (cl--find-class this-root)))
64 (fprefix (concat ch-prefix " +--")) 64 (fprefix (concat ch-prefix " +--"))
65 (mprefix (concat ch-prefix " | ")) 65 (mprefix (concat ch-prefix " | "))
66 (lprefix (concat ch-prefix " "))) 66 (lprefix (concat ch-prefix " ")))
@@ -84,7 +84,7 @@ If CLASS is actually an object, then also display current values of that object.
84 ;; Header line 84 ;; Header line
85 (prin1 class) 85 (prin1 class)
86 (insert " is a" 86 (insert " is a"
87 (if (eieio--class-option (eieio--class-v class) :abstract) 87 (if (eieio--class-option (cl--find-class class) :abstract)
88 "n abstract" 88 "n abstract"
89 "") 89 "")
90 " class") 90 " class")
@@ -162,7 +162,7 @@ If CLASS is actually an object, then also display current values of that object.
162(defun eieio-help-class-slots (class) 162(defun eieio-help-class-slots (class)
163 "Print help description for the slots in CLASS. 163 "Print help description for the slots in CLASS.
164Outputs to the current buffer." 164Outputs to the current buffer."
165 (let* ((cv (eieio--class-v class)) 165 (let* ((cv (cl--find-class class))
166 (slots (eieio--class-slots cv)) 166 (slots (eieio--class-slots cv))
167 (cslots (eieio--class-class-slots cv))) 167 (cslots (eieio--class-class-slots cv)))
168 (insert (propertize "Instance Allocated Slots:\n\n" 168 (insert (propertize "Instance Allocated Slots:\n\n"
@@ -181,7 +181,7 @@ If INSTANTIABLE-ONLY is non nil, only allow names of classes which
181are not abstract, otherwise allow all classes. 181are not abstract, otherwise allow all classes.
182Optional argument BUILDLIST is more list to attach and is used internally." 182Optional argument BUILDLIST is more list to attach and is used internally."
183 (let* ((cc (or class 'eieio-default-superclass)) 183 (let* ((cc (or class 'eieio-default-superclass))
184 (sublst (eieio--class-children (eieio--class-v cc)))) 184 (sublst (eieio--class-children (cl--find-class cc))))
185 (unless (assoc (symbol-name cc) buildlist) 185 (unless (assoc (symbol-name cc) buildlist)
186 (when (or (not instantiable-only) (not (class-abstract-p cc))) 186 (when (or (not instantiable-only) (not (class-abstract-p cc)))
187 ;; FIXME: Completion tables don't need alists, and ede/generic.el needs 187 ;; FIXME: Completion tables don't need alists, and ede/generic.el needs
@@ -452,7 +452,7 @@ current expansion depth."
452(defun eieio-class-button (class depth) 452(defun eieio-class-button (class depth)
453 "Draw a speedbar button at the current point for CLASS at DEPTH." 453 "Draw a speedbar button at the current point for CLASS at DEPTH."
454 (cl-check-type class class) 454 (cl-check-type class class)
455 (let ((subclasses (eieio--class-children (eieio--class-v class)))) 455 (let ((subclasses (eieio--class-children (cl--find-class class))))
456 (if subclasses 456 (if subclasses
457 (speedbar-make-tag-line 'angle ?+ 457 (speedbar-make-tag-line 'angle ?+
458 'eieio-sb-expand 458 'eieio-sb-expand
@@ -477,7 +477,7 @@ Argument INDENT is the depth of indentation."
477 (speedbar-with-writable 477 (speedbar-with-writable
478 (save-excursion 478 (save-excursion
479 (end-of-line) (forward-char 1) 479 (end-of-line) (forward-char 1)
480 (let ((subclasses (eieio--class-children (eieio--class-v class)))) 480 (let ((subclasses (eieio--class-children (cl--find-class class))))
481 (while subclasses 481 (while subclasses
482 (eieio-class-button (car subclasses) (1+ indent)) 482 (eieio-class-button (car subclasses) (1+ indent))
483 (setq subclasses (cdr subclasses))))))) 483 (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."
435 "Return child classes to CLASS. 435 "Return child classes to CLASS.
436The CLOS function `class-direct-subclasses' is aliased to this function." 436The CLOS function `class-direct-subclasses' is aliased to this function."
437 (cl-check-type class class) 437 (cl-check-type class class)
438 (eieio--class-children (eieio--class-v class))) 438 (eieio--class-children (cl--find-class class)))
439(define-obsolete-function-alias 439(define-obsolete-function-alias
440 'class-children #'eieio-class-children "24.4") 440 'class-children #'eieio-class-children "24.4")
441 441
@@ -566,7 +566,7 @@ OBJECT can be an instance or a class."
566 "Return the class that SYMBOL represents. 566 "Return the class that SYMBOL represents.
567If there is no class, nil is returned if ERRORP is nil. 567If there is no class, nil is returned if ERRORP is nil.
568If ERRORP is non-nil, `wrong-argument-type' is signaled." 568If ERRORP is non-nil, `wrong-argument-type' is signaled."
569 (let ((class (eieio--class-v symbol))) 569 (let ((class (cl--find-class symbol)))
570 (cond 570 (cond
571 ((eieio--class-p class) class) 571 ((eieio--class-p class) class)
572 (errorp (signal 'wrong-type-argument (list 'class-p symbol)))))) 572 (errorp (signal 'wrong-type-argument (list 'class-p symbol))))))
@@ -672,7 +672,7 @@ Its slots are automatically adopted by classes with no specified parents.
672This class is not stored in the `parent' slot of a class vector." 672This class is not stored in the `parent' slot of a class vector."
673 :abstract t) 673 :abstract t)
674 674
675(setq eieio-default-superclass (eieio--class-v 'eieio-default-superclass)) 675(setq eieio-default-superclass (cl--find-class 'eieio-default-superclass))
676 676
677(defalias 'standard-class 'eieio-default-superclass) 677(defalias 'standard-class 'eieio-default-superclass)
678 678
@@ -862,7 +862,7 @@ this object."
862 (princ comment) 862 (princ comment)
863 (princ "\n")) 863 (princ "\n"))
864 (let* ((cl (eieio-object-class this)) 864 (let* ((cl (eieio-object-class this))
865 (cv (eieio--class-v cl))) 865 (cv (cl--find-class cl)))
866 ;; Now output readable lisp to recreate this object 866 ;; Now output readable lisp to recreate this object
867 ;; It should look like this: 867 ;; It should look like this:
868 ;; (<constructor> <name> <slot> <slot> ... ) 868 ;; (<constructor> <name> <slot> <slot> ... )
@@ -978,7 +978,7 @@ Optional argument GROUP is the sub-group of slots to display.
978 978
979;;;*** 979;;;***
980 980
981;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "899e10c7883c4aac5cefcc223794e8f9") 981;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "b7995d9076e4dd4b9358b2aa66835619")
982;;; Generated autoloads from eieio-opt.el 982;;; Generated autoloads from eieio-opt.el
983 983
984(autoload 'eieio-browse "eieio-opt" "\ 984(autoload 'eieio-browse "eieio-opt" "\