GNU bug report logs - #66342
Quote cl-generic-current-method-specializers

Previous Next

Package: emacs;

Reported by: Thuna <thuna.cing <at> gmail.com>

Date: Wed, 4 Oct 2023 14:20:02 UTC

Severity: normal

Tags: moreinfo, patch

Full log


Message #10 received at 66342 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Thuna <thuna.cing <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 66342 <at> debbugs.gnu.org
Subject: Re: bug#66342: Quote cl-generic-current-method-specializers
Date: Tue, 11 Feb 2025 20:17:28 -0800
Thuna <thuna.cing <at> gmail.com> writes:

> 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.
>

Stefan M, could you please take a look at this patch?

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




This bug report was last modified 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.