Subject: Quote cl-generic-current-method-specializers

From: Thuna <[email-masked]>
Date: Wed, 04 Oct 2023 16:18:20 +0200

Currently, cl-generic-current-method-specializers expands into an alist
of the form ((ARG . TYPE)...).  The patch I provide quotes this so that
it can serve as a proper sexp.

Without quoting, this expansion is a bad sexp that, when evaluated,
results in an error.  If quoted, the form will simply not macroexpand,
and any other method causes it to be evaluated after expanding.  As it
relies on the cl-defmethod's context, I see no obvious and/or convenient
ways to use macroexpand to get the result unevaluated.

A quick grep brought up no uses of this macro, so I feel that this
change shouldn't effect many people, if any at all, although feel free
to correct me if this is not the case.

>From a5b3065b8db59570cd98e8799c0ba0b0c46b9d6f Mon Sep 17 00:00:00 2001
From: Thuna <[email-masked]>
Date: Sun, 1 Oct 2023 21:15:29 +0200
Subject: [PATCH] Quote cl-generic-current-method-specializers inside method
 body

* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Quote spec-args
when using cl-generic-current-method-specializers inside a method
body.
---
 lisp/emacs-lisp/cl-generic.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index dec14bd5df6..a938195f097 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -393,7 +393,7 @@ cl-generic-define-context-rewriter
                   (cl--generic-split-args args))
                  (fun `(cl-function (lambda ,plain-args ,@body)))
                  (macroenv (cons `(cl-generic-current-method-specializers
-                                   . ,(lambda () spec-args))
+                                   . ,(lambda () (list 'quote spec-args)))
                                  macroexpand-all-environment)))
       (require 'cl-lib)        ;Needed to expand `cl-flet' and `cl-function'.
       (when (assq 'interactive body)
-- 
2.39.3