unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66342: Quote cl-generic-current-method-specializers
@ 2023-10-04 14:18 Thuna
  0 siblings, 0 replies; only message in thread
From: Thuna @ 2023-10-04 14:18 UTC (permalink / raw)
  To: 66342

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: The patch --]
[-- Type: text/x-patch, Size: 1222 bytes --]

From a5b3065b8db59570cd98e8799c0ba0b0c46b9d6f Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing@gmail.com>
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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-04 14:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 14:18 bug#66342: Quote cl-generic-current-method-specializers Thuna

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).