summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-generic.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/cl-generic.el')
-rw-r--r--lisp/emacs-lisp/cl-generic.el9
1 files changed, 9 insertions, 0 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
(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