diff options
| -rw-r--r-- | lisp/emacs-lisp/eieio-base.el | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-core.el | 44 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio.el | 5 |
3 files changed, 27 insertions, 25 deletions
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index 534613811d4..fc78b3e098c 100644 --- a/lisp/emacs-lisp/eieio-base.el +++ b/lisp/emacs-lisp/eieio-base.el | |||
| @@ -277,8 +277,7 @@ identified, and needing more object creation." | |||
| 277 | (progn | 277 | (progn |
| 278 | ;; If OBJCLASS is an eieio autoload object, then we need to | 278 | ;; If OBJCLASS is an eieio autoload object, then we need to |
| 279 | ;; load it. | 279 | ;; load it. |
| 280 | (eieio-class-un-autoload objclass) | 280 | (eieio--full-class-object objclass)))) |
| 281 | (eieio--class-object objclass)))) | ||
| 282 | 281 | ||
| 283 | (while slots | 282 | (while slots |
| 284 | (let ((initarg (car slots)) | 283 | (let ((initarg (car slots)) |
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 620b47e68d2..09aed101a3c 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el | |||
| @@ -125,7 +125,8 @@ Currently under control of this var: | |||
| 125 | (defsubst eieio--class-object (class) | 125 | (defsubst eieio--class-object (class) |
| 126 | "Return the class object." | 126 | "Return the class object." |
| 127 | (if (symbolp class) | 127 | (if (symbolp class) |
| 128 | ;; Keep the symbol if class-v is nil, for better error messages. | 128 | ;; Return the symbol if the class object doesn't exist, |
| 129 | ;; for better error messages. | ||
| 129 | (or (cl--find-class class) class) | 130 | (or (cl--find-class class) class) |
| 130 | class)) | 131 | class)) |
| 131 | 132 | ||
| @@ -217,10 +218,6 @@ It creates an autoload function for CNAME's constructor." | |||
| 217 | (make-obsolete-variable cname (format "use \\='%s instead" cname) | 218 | (make-obsolete-variable cname (format "use \\='%s instead" cname) |
| 218 | "25.1")) | 219 | "25.1")) |
| 219 | 220 | ||
| 220 | ;; Store the new class vector definition into the symbol. We need to | ||
| 221 | ;; do this first so that we can call defmethod for the accessor. | ||
| 222 | ;; The vector will be updated by the following while loop and will not | ||
| 223 | ;; need to be stored a second time. | ||
| 224 | (setf (cl--find-class cname) newc) | 221 | (setf (cl--find-class cname) newc) |
| 225 | 222 | ||
| 226 | ;; Create an autoload on top of our constructor function. | 223 | ;; Create an autoload on top of our constructor function. |
| @@ -230,9 +227,17 @@ It creates an autoload function for CNAME's constructor." | |||
| 230 | (autoload (intern (format "%s-child-p" cname)) filename "" nil nil) | 227 | (autoload (intern (format "%s-child-p" cname)) filename "" nil nil) |
| 231 | (autoload (intern (format "%s-list-p" cname)) filename "" nil nil))))) | 228 | (autoload (intern (format "%s-list-p" cname)) filename "" nil nil))))) |
| 232 | 229 | ||
| 233 | (defsubst eieio-class-un-autoload (cname) | 230 | (defun eieio--full-class-object (class) |
| 234 | "If class CNAME is in an autoload state, load its file." | 231 | "Like `eieio--class-object' but loads the class if needed." |
| 235 | (autoload-do-load (symbol-function cname))) ; cname | 232 | (let ((c (eieio--class-object class))) |
| 233 | (and (not (symbolp c)) | ||
| 234 | ;; If the default-object-cache slot is nil, the class object | ||
| 235 | ;; is still a "dummy" setup by eieio-defclass-autoload. | ||
| 236 | (not (eieio--class-default-object-cache c)) | ||
| 237 | ;; FIXME: We rely on the autoload setup for the "standard" | ||
| 238 | ;; constructor, here! | ||
| 239 | (autoload-do-load (symbol-function (eieio--class-name c)))) | ||
| 240 | c)) | ||
| 236 | 241 | ||
| 237 | (cl-deftype list-of (elem-type) | 242 | (cl-deftype list-of (elem-type) |
| 238 | `(and list | 243 | `(and list |
| @@ -730,9 +735,7 @@ Argument FN is the function calling this verifier." | |||
| 730 | (cl-check-type obj (or eieio-object class)) | 735 | (cl-check-type obj (or eieio-object class)) |
| 731 | (let* ((class (cond ((symbolp obj) | 736 | (let* ((class (cond ((symbolp obj) |
| 732 | (error "eieio-oref called on a class: %s" obj) | 737 | (error "eieio-oref called on a class: %s" obj) |
| 733 | (let ((c (cl--find-class obj))) | 738 | (eieio--full-class-object obj)) |
| 734 | (if (eieio--class-p c) (eieio-class-un-autoload obj)) | ||
| 735 | c)) | ||
| 736 | (t (eieio--object-class obj)))) | 739 | (t (eieio--object-class obj)))) |
| 737 | (c (eieio--slot-name-index class slot))) | 740 | (c (eieio--slot-name-index class slot))) |
| 738 | (if (not c) | 741 | (if (not c) |
| @@ -1013,16 +1016,15 @@ The order, in which the parents are returned depends on the | |||
| 1013 | method invocation orders of the involved classes." | 1016 | method invocation orders of the involved classes." |
| 1014 | (if (or (null class) (eq class eieio-default-superclass)) | 1017 | (if (or (null class) (eq class eieio-default-superclass)) |
| 1015 | nil | 1018 | nil |
| 1016 | (unless (eieio--class-default-object-cache class) | 1019 | (let ((class (eieio--full-class-object class))) |
| 1017 | (eieio-class-un-autoload (eieio--class-name class))) | 1020 | (cl-case (eieio--class-method-invocation-order class) |
| 1018 | (cl-case (eieio--class-method-invocation-order class) | 1021 | (:depth-first |
| 1019 | (:depth-first | 1022 | (eieio--class-precedence-dfs class)) |
| 1020 | (eieio--class-precedence-dfs class)) | 1023 | (:breadth-first |
| 1021 | (:breadth-first | 1024 | (eieio--class-precedence-bfs class)) |
| 1022 | (eieio--class-precedence-bfs class)) | 1025 | (:c3 |
| 1023 | (:c3 | 1026 | (eieio--class-precedence-c3 class)))))) |
| 1024 | (eieio--class-precedence-c3 class)))) | 1027 | |
| 1025 | ) | ||
| 1026 | (define-obsolete-function-alias | 1028 | (define-obsolete-function-alias |
| 1027 | 'class-precedence-list 'eieio--class-precedence-list "24.4") | 1029 | 'class-precedence-list 'eieio--class-precedence-list "24.4") |
| 1028 | 1030 | ||
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 4b899cdc64a..9c3420176f1 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el | |||
| @@ -425,10 +425,11 @@ If EXTRA, include that in the string returned to represent the symbol." | |||
| 425 | 'object-class-name 'eieio-object-class-name "24.4") | 425 | 'object-class-name 'eieio-object-class-name "24.4") |
| 426 | 426 | ||
| 427 | (defun eieio-class-parents (class) | 427 | (defun eieio-class-parents (class) |
| 428 | ;; FIXME: What does "(overload of variable)" mean here? | ||
| 428 | "Return parent classes to CLASS. (overload of variable). | 429 | "Return parent classes to CLASS. (overload of variable). |
| 429 | 430 | ||
| 430 | The CLOS function `class-direct-superclasses' is aliased to this function." | 431 | The CLOS function `class-direct-superclasses' is aliased to this function." |
| 431 | (eieio--class-parents (eieio--class-object class))) | 432 | (eieio--class-parents (eieio--full-class-object class))) |
| 432 | 433 | ||
| 433 | (define-obsolete-function-alias 'class-parents #'eieio-class-parents "24.4") | 434 | (define-obsolete-function-alias 'class-parents #'eieio-class-parents "24.4") |
| 434 | 435 | ||
| @@ -468,7 +469,7 @@ The CLOS function `class-direct-subclasses' is aliased to this function." | |||
| 468 | 469 | ||
| 469 | (defun child-of-class-p (child class) | 470 | (defun child-of-class-p (child class) |
| 470 | "Return non-nil if CHILD class is a subclass of CLASS." | 471 | "Return non-nil if CHILD class is a subclass of CLASS." |
| 471 | (setq child (eieio--class-object child)) | 472 | (setq child (eieio--full-class-object child)) |
| 472 | (cl-check-type child eieio--class) | 473 | (cl-check-type child eieio--class) |
| 473 | ;; `eieio-default-superclass' is never mentioned in eieio--class-parents, | 474 | ;; `eieio-default-superclass' is never mentioned in eieio--class-parents, |
| 474 | ;; so we have to special case it here. | 475 | ;; so we have to special case it here. |