summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/cl-generic.el9
-rw-r--r--lisp/emacs-lisp/eieio-compat.el3
-rw-r--r--lisp/emacs-lisp/eieio-core.el4
3 files changed, 13 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index e5bab8dba9..4f263c6bb8 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -671,6 +671,15 @@ FUN is the function that should be called when METHOD calls
(setq fun (cl-generic-call-method generic method fun)))
fun)))))
+(defun cl-generic-apply (generic args)
+ "Like `apply' but takes a cl-generic object rather than a function."
+ ;; Handy in cl-no-applicable-method, for example.
+ ;; In Common Lisp, generic-function objects are funcallable. Ideally
+ ;; we'd want the same in Elisp, but it would either require using a very
+ ;; different (and less efficient) representation of cl--generic objects,
+ ;; or non-trivial changes in the general infrastructure (compiler and such).
+ (apply (cl--generic-name generic) args))
+
(defun cl--generic-arg-specializer (method dispatch-arg)
(or (if (integerp dispatch-arg)
(nth dispatch-arg
diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el
index 6d4798b92f..6aba8a3acb 100644
--- a/lisp/emacs-lisp/eieio-compat.el
+++ b/lisp/emacs-lisp/eieio-compat.el
@@ -188,7 +188,8 @@ Summary:
(`no-applicable-method
(setq method 'cl-no-applicable-method)
(setq specializers `(generic ,@specializers))
- (lambda (generic arg &rest args) (apply code arg generic args)))
+ (lambda (generic arg &rest args)
+ (apply code arg (cl--generic-name generic) (cons arg args))))
(_ code))))
(cl-generic-define-method
method (unless (memq kind '(nil :primary)) (list kind))
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index 631e4a437f..223c2a69a6 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -976,7 +976,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 (cl--find-class class))))
+ (let ((parents (eieio--class-parents class)))
(eieio--c3-merge-lists
(list class)
(append
@@ -1101,7 +1101,7 @@ method invocation orders of the involved classes."
(list eieio--generic-subclass-generalizer))
-;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "6aca3c1b5f751a01331761da45fc4f5c")
+;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "dba4205b1a0d7133f1311d975b4d0ebe")
;;; Generated autoloads from eieio-compat.el
(autoload 'eieio--defalias "eieio-compat" "\