GNU bug report logs - #72328
[PATCH] Nested backquote in pcase

Previous Next

Package: emacs;

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

Date: Sun, 28 Jul 2024 01:06:02 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: michael_heerdegen <at> web.de, thuna.cing <at> gmail.com, 72328 <at> debbugs.gnu.org
Subject: Re: bug#72328: [PATCH] Nested backquote in pcase
Date: Fri, 23 Aug 2024 22:29:10 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: michael_heerdegen <at> web.de,  thuna.cing <at> gmail.com,  72328 <at> debbugs.gnu.org
> Date: Fri, 23 Aug 2024 15:11:04 -0400
> 
> >> > Would be good to hear from Stefan
> >> The first step is to declare nested backquotes unsupported and add
> >> a warning when we encounter them.
> > Where and how would you suggest to do that?
> 
> Somethink like...
> 
> 
>         Stefan
> 
> 
> diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
> index fd6b0c8db5c..fe62820f0cb 100644
> --- a/lisp/emacs-lisp/pcase.el
> +++ b/lisp/emacs-lisp/pcase.el
> @@ -1172,7 +1172,10 @@ pcase--expand-\`
>            (upatd (pcase--expand-\` (cdr qpat))))
>        (if (and (eq (car-safe upata) 'quote) (eq (car-safe upatd) 'quote))
>            `'(,(cadr upata) . ,(cadr upatd))
> -        `(and (pred consp)
> +        `(and ,@(when (eq (car qpat) '\`)
> +                  `((guard ,(macroexp-warn-and-return
> +                             "Nested ` are not supported" t nil nil qpat))))
> +              (pred consp)
>                (app car-safe ,upata)
>                (app cdr-safe ,upatd)))))
>     ((or (stringp qpat) (numberp qpat) (symbolp qpat)) `',qpat)

Feel free to install on master, and thanks.




This bug report was last modified 236 days ago.

Previous Next


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