From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72328: [PATCH] Nested backquote in pcase Date: Fri, 23 Aug 2024 15:11:04 -0400 Message-ID: References: <87jzh62vtr.fsf@gmail.com> <877cd5k1ra.fsf@web.de> <871q3d347e.fsf@gmail.com> <877cd4rxqo.fsf@web.de> <867cd4ywnq.fsf@gnu.org> <87mslumpsw.fsf@gmail.com> <86msluuox9.fsf@gnu.org> <875xshn3km.fsf@gmail.com> <87cymo6wp9.fsf@web.de> <87v80gkmg7.fsf@gmail.com> <86ikwfqj9w.fsf@gnu.org> <87a5hqzrxg.fsf@gmail.com> <86o765q4yo.fsf@gnu.org> <871q31ztju.fsf@gmail.com> <87bk2580rv.fsf@web.de> <87msloxmmv.fsf@gmail.com> <86jzgrmua0.fsf@gnu.org> <87v7zrncmw.fsf@web.de> <86plpzp6oc.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22314"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: michael_heerdegen@web.de, thuna.cing@gmail.com, 72328@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 23 21:12:33 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1shZi4-0005gI-Gj for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Aug 2024 21:12:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shZhp-0002Z6-3P; Fri, 23 Aug 2024 15:12:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shZhn-0002T0-8a for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2024 15:12:15 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shZhn-0005wZ-0D for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2024 15:12:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=frnM5YHVPsv54tUJLSoF2qOh38UO8a6pKpEVg4Eew7Q=; b=Sgg+L/URxVUmTGfEsirR83RbGvAhb9lpsfOoW0nSRD8Vi3VtW1u6a7P2Oyq3yKG8EA/Jg9kbWNVqpBM87QDWZHs9urZzv26HVFvALgaYvllMb0oaA6KhJ+ZKp8/daKoHl8eQXP6m6+dVuEaPnYxkRiBy9erqhK0ehpbb1oFhOoqRTB5+MPCd1Hn+i31kIZPEwNyybriAsD9pkQSacF54qr73SGtDPYNyZFkyIPra6wOJFvOoF3dtNPk8DnOjP1wN3cMGJ2QkpxbNc9eQgM1Rm0saB7bpxeArSRMTyxrRlWOS9DOrdOxpZq+mIxc0h9a82OX2qNQNDcvwhJidN6EzIw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1shZiY-0001ix-2S for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2024 15:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Aug 2024 19:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72328 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72328-submit@debbugs.gnu.org id=B72328.17244403256551 (code B ref 72328); Fri, 23 Aug 2024 19:13:02 +0000 Original-Received: (at 72328) by debbugs.gnu.org; 23 Aug 2024 19:12:05 +0000 Original-Received: from localhost ([127.0.0.1]:40138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shZhc-0001hb-Rj for submit@debbugs.gnu.org; Fri, 23 Aug 2024 15:12:05 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11937) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shZha-0001h1-AB for 72328@debbugs.gnu.org; Fri, 23 Aug 2024 15:12:03 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D26964443F0; Fri, 23 Aug 2024 15:11:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1724440265; bh=OphU5rOZBjKbxNV/b302kVB+1D39RLRRSgA2Jpv5Z4w=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=exC7Epo8J823wZ0W95Y6ssV2Lvbmy+3h+3qiQ9ppuh741k/Rmd7Yb49tQ73huiGJW RqfjqVHObg29H0bjTYmeYW4tHdXFvsFKjszeSXb/7rJGvZpxdc4lq7FWnxM1lQXZjG SFitZ7PklFcRcT3nzymB71hVwYoGJ9PIGtj2vB+1UH60F5h/aP4tvqcpuegJKGfKGe yDr+J+kyfSiU/FlHrURbDb3PDbA0XtOU5Myjf1tnC1onxU7lGb3fNeiuE6EeW/SZc6 xFOyxyxtC09WhpWRIZsUImjdhSCRh7JF8dGVqQsA1RwZEWEgsYo0WwHWhjPvtS5xWT 4MKrs08R1fncg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5EA464443EA; Fri, 23 Aug 2024 15:11:05 -0400 (EDT) Original-Received: from pastel (unknown [216.154.9.87]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2EC67120287; Fri, 23 Aug 2024 15:11:05 -0400 (EDT) In-Reply-To: <86plpzp6oc.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 23 Aug 2024 19:04:03 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290608 Archived-At: >> > 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)