diff options
| author | Stefan Monnier | 2016-07-14 15:05:49 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2016-07-14 15:05:49 -0400 |
| commit | 452aa949bc4de77b1fba103de6b61e55b2ca8c0b (patch) | |
| tree | 58319df24bba25748d2aa75177f582378157b752 | |
| parent | 248d5dd13cd2ae0b1319a52b331e451fa7dd99c8 (diff) | |
| download | emacs-452aa949bc4de77b1fba103de6b61e55b2ca8c0b.tar.gz emacs-452aa949bc4de77b1fba103de6b61e55b2ca8c0b.zip | |
Fix eieio vs cl-generic incompatibilities found in Rudel (bug#23947)
* lisp/emacs-lisp/cl-generic.el (cl-generic-apply): New function.
* lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Fix incorrect
mapping between cl-no-applicable-method and EIEIO's no-applicable-method.
* lisp/emacs-lisp/eieio-core.el (eieio--class-precedence-c3):
`class' is not a symbol but a class object.
| -rw-r--r-- | lisp/emacs-lisp/cl-generic.el | 9 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-compat.el | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-core.el | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index e5bab8dba99..4f263c6bb8d 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 | |||
| 671 | (setq fun (cl-generic-call-method generic method fun))) | 671 | (setq fun (cl-generic-call-method generic method fun))) |
| 672 | fun))))) | 672 | fun))))) |
| 673 | 673 | ||
| 674 | (defun cl-generic-apply (generic args) | ||
| 675 | "Like `apply' but takes a cl-generic object rather than a function." | ||
| 676 | ;; Handy in cl-no-applicable-method, for example. | ||
| 677 | ;; In Common Lisp, generic-function objects are funcallable. Ideally | ||
| 678 | ;; we'd want the same in Elisp, but it would either require using a very | ||
| 679 | ;; different (and less efficient) representation of cl--generic objects, | ||
| 680 | ;; or non-trivial changes in the general infrastructure (compiler and such). | ||
| 681 | (apply (cl--generic-name generic) args)) | ||
| 682 | |||
| 674 | (defun cl--generic-arg-specializer (method dispatch-arg) | 683 | (defun cl--generic-arg-specializer (method dispatch-arg) |
| 675 | (or (if (integerp dispatch-arg) | 684 | (or (if (integerp dispatch-arg) |
| 676 | (nth dispatch-arg | 685 | (nth dispatch-arg |
diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el index 6d4798b92f9..6aba8a3acbd 100644 --- a/lisp/emacs-lisp/eieio-compat.el +++ b/lisp/emacs-lisp/eieio-compat.el | |||
| @@ -188,7 +188,8 @@ Summary: | |||
| 188 | (`no-applicable-method | 188 | (`no-applicable-method |
| 189 | (setq method 'cl-no-applicable-method) | 189 | (setq method 'cl-no-applicable-method) |
| 190 | (setq specializers `(generic ,@specializers)) | 190 | (setq specializers `(generic ,@specializers)) |
| 191 | (lambda (generic arg &rest args) (apply code arg generic args))) | 191 | (lambda (generic arg &rest args) |
| 192 | (apply code arg (cl--generic-name generic) (cons arg args)))) | ||
| 192 | (_ code)))) | 193 | (_ code)))) |
| 193 | (cl-generic-define-method | 194 | (cl-generic-define-method |
| 194 | method (unless (memq kind '(nil :primary)) (list kind)) | 195 | 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 631e4a437f2..223c2a69a62 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." | |||
| 976 | 976 | ||
| 977 | (defun eieio--class-precedence-c3 (class) | 977 | (defun eieio--class-precedence-c3 (class) |
| 978 | "Return all parents of CLASS in c3 order." | 978 | "Return all parents of CLASS in c3 order." |
| 979 | (let ((parents (eieio--class-parents (cl--find-class class)))) | 979 | (let ((parents (eieio--class-parents class))) |
| 980 | (eieio--c3-merge-lists | 980 | (eieio--c3-merge-lists |
| 981 | (list class) | 981 | (list class) |
| 982 | (append | 982 | (append |
| @@ -1101,7 +1101,7 @@ method invocation orders of the involved classes." | |||
| 1101 | (list eieio--generic-subclass-generalizer)) | 1101 | (list eieio--generic-subclass-generalizer)) |
| 1102 | 1102 | ||
| 1103 | 1103 | ||
| 1104 | ;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "6aca3c1b5f751a01331761da45fc4f5c") | 1104 | ;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "dba4205b1a0d7133f1311d975b4d0ebe") |
| 1105 | ;;; Generated autoloads from eieio-compat.el | 1105 | ;;; Generated autoloads from eieio-compat.el |
| 1106 | 1106 | ||
| 1107 | (autoload 'eieio--defalias "eieio-compat" "\ | 1107 | (autoload 'eieio--defalias "eieio-compat" "\ |