From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thuna Newsgroups: gmane.emacs.bugs Subject: bug#72434: [PATCH] Print list-ending comma/backquote forms specially Date: Sat, 03 Aug 2024 03:31:28 +0200 Message-ID: <87ikwimlxr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26385"; mail-complaints-to="usenet@ciao.gmane.io" To: 72434@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 03 03:32:12 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 1sa3cy-0006jG-BY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Aug 2024 03:32:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sa3ce-00079H-9v; Fri, 02 Aug 2024 21:31:52 -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 1sa3cb-00078r-JY for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 21:31:50 -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 1sa3cW-0000aw-5w for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 21:31:48 -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:From:To:Subject; bh=ppPFVBWW7xOg8rY/7/Cg3fIBNea6/ggc2gKOFTMaAkw=; b=mhzazuwHa8grpmZmuo9wixJQfeY89pehh2OzoswOe9Z0fpj7daHMkiA7OG6UTdZfb+vgbVxno+YxzXxxuVnWEVsLjSmWQO4vvXBz2Bz1l/a1JFUaKp2hMR3gBjKYMyQZ/aGrnBfaXJ9QWxtAxOf/whbMBE/Gqyn/XpyoFZ9iHQiqQiccXSZApH+Btxk7MCPLqKMVu4dUwG3MIQzRsfxc1BXOitJ9OFcLPEku3+gWxAIAufP2c8nG4ddWWiqwwah3i4AzHmoTTGNiGgds6p69JusLTSlRMEM4UF1c2Wdj0FTtRPqrGgYXpF+BWgo9KYAKZUDiap/nm39j+NpNztmg5Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sa3co-00038a-8V for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 21:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thuna Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2024 01:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72434 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172264872012050 (code B ref -1); Sat, 03 Aug 2024 01:32:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Aug 2024 01:32:00 +0000 Original-Received: from localhost ([127.0.0.1]:53896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sa3cm-00038I-0j for submit@debbugs.gnu.org; Fri, 02 Aug 2024 21:32:00 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sa3ci-000389-Mr for submit@debbugs.gnu.org; Fri, 02 Aug 2024 21:31:57 -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 1sa3cP-00073N-8W for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 21:31:37 -0400 Original-Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sa3cN-0000Zx-MB for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 21:31:37 -0400 Original-Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-368440b073bso2390380f8f.0 for ; Fri, 02 Aug 2024 18:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722648694; x=1723253494; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=ppPFVBWW7xOg8rY/7/Cg3fIBNea6/ggc2gKOFTMaAkw=; b=fAQCowDRPjl4IALPtyTMs5bW5irqccGCMOubf6mr6pZ+TLmorApO4fCzOkekWLaXlf 8008F0EClfb0aBlwxxFBPZaqvOlx1NzbYQ33IHnTxzEBIfG0Gv8BPkIEc5VyNQY3dQVa Eayx6/yarZMaBx1F/dbcgWP8JVy/MqY5r4TwOBe0hwIrOwbcBGg84dxXlsDVdyqJAxXC 3jg4+fVTHkBt1z8uM2bbJPHrzT+MxzhOD62XBK2ndmgj+Il68ed8NoFYgw/xcMxvHvf5 l50wjBQpzKtVvvK3MH26jjYpVP+kmtbQ5zDDVGXA++w1cdB88Nz1lHmHQqweJe60inue 8Lrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722648694; x=1723253494; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ppPFVBWW7xOg8rY/7/Cg3fIBNea6/ggc2gKOFTMaAkw=; b=qPnWtxoQ0B1TF0QhOHAaBV7QCF5WNKrY+cNV/dzdYAUuGb0hSzSfC+gmDkdpYIEges ClhUm8coQteKlqEaJupFT8Ofj42i23GAeNzTdpNTScI+fcBuDShI2eRTxaGj50bbZLFm 8KSHXD0CjTAqtZpmZN/+yUKRl21RgdzVF0GtCOfrp5TRC4fPVdYQg+T7HPzCfC6UbiLq QRpC+OThz0J/tVflT9sLuNeoJk21NaOvVEOUlJfEzz0y1K3It6QYqOq8OGxSzTVlZK5M P1HgjmIhhMh9NTCG5shN6yJ404WxCAvpU3Aj5pOi1IpEmKXhQlFTKhSnfv/gN9IzoKOE ayZw== X-Gm-Message-State: AOJu0YyeQUw6MBqtQg8OcLn9MDfATTQFEmclGLtg9wAyBjXfhAX9hdlp pMhUWVGbjMNthi4QQSmKondQj15h8ZRrw7q5PfygM2+yg9TeJPKMcmX/GQ== X-Google-Smtp-Source: AGHT+IH2sIbAioBCQWbK3L7AR/6fAu178koJF+3cFM9CcDi5piv7NBLJTO0Ui2cokigijA7+zF1fYA== X-Received: by 2002:adf:e3c1:0:b0:367:89ae:c204 with SMTP id ffacd0b85a97d-36bb35aa98bmr5052944f8f.12.1722648693365; Fri, 02 Aug 2024 18:31:33 -0700 (PDT) Original-Received: from thuna-lis3 ([85.106.105.81]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bab9f7esm108124675e9.21.2024.08.02.18.31.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 18:31:32 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=thuna.cing@gmail.com; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:289656 Archived-At: --=-=-= Content-Type: text/plain (This patch follows from 72334, but that patch is not necessary for this one to work.) Currently something like the following (unevaluated) form: `(foo bar . ,baz) prints as `(foo bar \, baz) which, while technically accurate, is not helpful. This comes up quite often in pcase forms where a pattern like `(,head . ,_) is extremely common. This patch fixes that, such that if the tail of a list is a proper list of two elements whose car is a backquote, comma, or comma-at (so ,foo ,@foo and `foo), and print-quoted is non-nil, the printed text will be in the first form above. Better ways to implement this are likely possible; this was simply the easiest and quickest one. Feel free to change the patch as needed. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Print-list-terminating-backquote-and-comma-forms-spe.patch >From 4cea5d48a772870df40f7d33fc0a87cdcfc9bbc1 Mon Sep 17 00:00:00 2001 From: Thuna Date: Sat, 3 Aug 2024 03:17:49 +0200 Subject: [PATCH] Print list terminating backquote and comma forms specially * src/print.c (print_object): When `print-quoted' is non-nil print a list-terminating (\` obj) as though it terminates the list with a " . " --- src/print.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/print.c b/src/print.c index 256f19aeb90..d654ab76799 100644 --- a/src/print.c +++ b/src/print.c @@ -2656,7 +2656,13 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) --print_depth; goto next_obj; } - else if (CONSP (next)) + else if (CONSP (next) + && !(print_quoted + && (EQ (Qbackquote, XCAR (next)) + || EQ (Qcomma, XCAR (next)) + || EQ (Qcomma_at, XCAR (next))) + && CONSP (XCDR (next)) + && NILP (XCDR (XCDR (next))))) { if (!NILP (Vprint_circle)) { -- 2.44.2 --=-=-=--