X-Loop: help-debbugs@HIDDEN Subject: bug#72434: [PATCH] Print list-ending comma/backquote forms specially Resent-From: Thuna <thuna.cing@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sat, 03 Aug 2024 01:32:02 +0000 Resent-Message-ID: <handler.72434.B.172264872012050 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 72434 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 72434 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.172264872012050 (code B ref -1); Sat, 03 Aug 2024 01:32:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Aug 2024 01:32:00 +0000 Received: from localhost ([127.0.0.1]:53896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sa3cm-00038I-0j for submit <at> debbugs.gnu.org; Fri, 02 Aug 2024 21:32:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:54470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <thuna.cing@HIDDEN>) id 1sa3ci-000389-Mr for submit <at> debbugs.gnu.org; Fri, 02 Aug 2024 21:31:57 -0400 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 <thuna.cing@HIDDEN>) id 1sa3cP-00073N-8W for bug-gnu-emacs@HIDDEN; Fri, 02 Aug 2024 21:31:37 -0400 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 <thuna.cing@HIDDEN>) id 1sa3cN-0000Zx-MB for bug-gnu-emacs@HIDDEN; Fri, 02 Aug 2024 21:31:37 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-368440b073bso2390380f8f.0 for <bug-gnu-emacs@HIDDEN>; 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) 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 <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 18:31:32 -0700 (PDT) From: Thuna <thuna.cing@HIDDEN> Date: Sat, 03 Aug 2024 03:31:28 +0200 Message-ID: <87ikwimlxr.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=thuna.cing@HIDDEN; 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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) --=-=-= 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 <thuna.cing@HIDDEN> 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 --=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Thuna <thuna.cing@HIDDEN> Subject: bug#72434: Acknowledgement ([PATCH] Print list-ending comma/backquote forms specially) Message-ID: <handler.72434.B.172264872012050.ack <at> debbugs.gnu.org> References: <87ikwimlxr.fsf@HIDDEN> X-Gnu-PR-Message: ack 72434 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 72434 <at> debbugs.gnu.org Date: Sat, 03 Aug 2024 01:32:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 72434 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 72434: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72434 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#72434: [PATCH] Print list-ending comma/backquote forms specially In-Reply-To: <87ikwimlxr.fsf@HIDDEN> Resent-From: Thuna <thuna.cing@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sat, 03 Aug 2024 01:46:01 +0000 Resent-Message-ID: <handler.72434.B.172264950113476 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 72434 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 72434 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.172264950113476 (code B ref -1); Sat, 03 Aug 2024 01:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Aug 2024 01:45:01 +0000 Received: from localhost ([127.0.0.1]:53909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sa3pN-0003V5-4H for submit <at> debbugs.gnu.org; Fri, 02 Aug 2024 21:45:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:38138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1sa3pL-0003Ux-10 for submit <at> debbugs.gnu.org; Fri, 02 Aug 2024 21:44:59 -0400 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 <geb-bug-gnu-emacs@HIDDEN>) id 1sa3p1-00082p-Ot for bug-gnu-emacs@HIDDEN; Fri, 02 Aug 2024 21:44:39 -0400 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1sa3p0-0004fA-E6 for bug-gnu-emacs@HIDDEN; Fri, 02 Aug 2024 21:44:39 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1sa3ox-0007KD-0B for bug-gnu-emacs@HIDDEN; Sat, 03 Aug 2024 03:44:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Thuna <thuna.cing@HIDDEN> Date: Sat, 03 Aug 2024 03:44:30 +0200 Message-ID: <878qxemlc1.fsf@HIDDEN> References: <87ikwimlxr.fsf@HIDDEN> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:doyHmRcCDs/iM8dWwIEDbq1tY3E= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@HIDDEN; helo=ciao.gmane.io X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.4 (-) > (This patch follows from 72334, but that patch is not necessary for this > one to work.) Actually, that is incorrect...-ish. The specific problem happens when you encounter a comma or comma-at while not inside a backquote. With 72334 this is not a problem, but without it you end up with the (unevaluated) form (foo bar . ,baz) printed as (foo bar . (\, baz)) which is obviously not ideal. It /should/ be possible to lightly change the patch to have it work, by checking `new_backquote_output' in case the car is a comma or a comma-at but honestly I would just rather 72334 be pushed instead.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.