GNU bug report logs - #72334
[PATCH] Always print commas and comma-ats specially

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Thuna <thuna.cing@HIDDEN>; Keywords: patch; dated Sun, 28 Jul 2024 13:34:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Jul 2024 13:33:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 28 09:33:13 2024
Received: from localhost ([127.0.0.1]:42875 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sY41R-0000aR-0m
	for submit <at> debbugs.gnu.org; Sun, 28 Jul 2024 09:33:13 -0400
Received: from lists.gnu.org ([209.51.188.17]:41648)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <thuna.cing@HIDDEN>) id 1sY41N-0000aG-30
 for submit <at> debbugs.gnu.org; Sun, 28 Jul 2024 09:33:11 -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 1sY3z4-0001YM-Ep
 for bug-gnu-emacs@HIDDEN; Sun, 28 Jul 2024 09:30:46 -0400
Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536])
 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 1sY3z2-0001dC-Nn
 for bug-gnu-emacs@HIDDEN; Sun, 28 Jul 2024 09:30:46 -0400
Received: by mail-ed1-x536.google.com with SMTP id
 4fb4d7f45d1cf-5af326eddb2so3433463a12.1
 for <bug-gnu-emacs@HIDDEN>; Sun, 28 Jul 2024 06:30:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1722173443; x=1722778243; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=whHvVij2LDqqwEQVi+72aU2sl7NB3Gl80LHvO0s4zVo=;
 b=BQa3bUQEDQE4FDoD84dOPAnDPRb9NCQ9kDX6gPyEAmnDwTZveuKhMjm8o6fvyZnBn0
 hGJqtDPsVPtRIsHbFpRneVr69ZiGcxmdYO1B8P9HVuMqJzN1j5FyyVrw9PVY5dWb0ET4
 okTuOPfbE0NZwGJjTjbVhDgZLJTr5WHJEZD9DapptlbVlty45puNzmx/TYF43eAV4j5n
 5Q+R/YuWV3weiT89TVosHeyitmMMtBHPT431sewV9z0UWXLLlrkyGE4OfLS6cWIZy+79
 M4n6YWn+eL5pTRF7hy8oOs1gbz0c8ZKNq4bVAg9gEj42Oh4lI/uOKDYdGft1YYDfMpAc
 7PTQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1722173443; x=1722778243;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=whHvVij2LDqqwEQVi+72aU2sl7NB3Gl80LHvO0s4zVo=;
 b=mWJ17Sg05oDgjbN1Fp6F1kO4DIsHyReYRSbQceWFKcdbnVRrHMCP0JYadZIcn21lDL
 4FDK5466um1jfIN2J+KuFn2nMvuggMBi0vaXbdpJ2dRdtjGB5rG6CZKTsn/Mnce2JYAC
 +FUgxzZ3ewUcr9sIrobxyMJLmH36TRDXTMKc+JWzRGhx2o6JwxY9bpDKfJj8dM/w0+1w
 u90oCN6qfLpTcJNy1bM/TtEIBJle16MbK2nXGGir4jpXntrTntmxF2L9FMJ5tkM/A2m1
 Mf/pig8fAoiuyzmFzoM9uEUo3YyT05vUWKhSmil0a21ONxHk6pthjeaam7QXO+6ekEDa
 juyA==
X-Gm-Message-State: AOJu0YyMhzMZn3+COh1y4uaquf3HRu06603cBT/QobV4vgnQ01SFY1Pz
 6CRsa13QSk23HGN1KsidwPVpStwteCnVH2EgGDbS6FSOBJF9EOe8leHMrw==
X-Google-Smtp-Source: AGHT+IFfziqBWEj22BH59XX5QYIlRQcIoRjLdYsp/EcjckDnK3k4prYhvZsQbcNgZVQXE5wvH5odvA==
X-Received: by 2002:a50:d581:0:b0:5a0:d5f2:1be with SMTP id
 4fb4d7f45d1cf-5b214865f85mr1298557a12.8.1722173442563; 
 Sun, 28 Jul 2024 06:30:42 -0700 (PDT)
Received: from thuna-lis3 ([85.106.105.81]) by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5ac6359392bsm4321445a12.33.2024.07.28.06.30.41
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 28 Jul 2024 06:30:41 -0700 (PDT)
From: Thuna <thuna.cing@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Always print commas and comma-ats specially
Date: Sun, 28 Jul 2024 15:30:40 +0200
Message-ID: <874j893apr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::536;
 envelope-from=thuna.cing@HIDDEN; helo=mail-ed1-x536.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-Debbugs-Envelope-To: submit
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

In 55481 the recursion was fixed but backquotes and comma(-at)s were
left as-is, so as to print comma(-at)s specially only if they are
escaping a backquote.

This is not particularly useful (and I would argue is bad), so something
like the attached patch could be a good starting point to make it so
that they are always printed specially (given `print-quoted' is non-nil
and it is a proper list of length two - the usual checks for other
quoted forms), which also solves(maybe? - it was not the primary goal)
the recursion.  Feel free to change or drop whatever.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Always-print-commas-and-comma-ats-specially-with-pri.patch

From bdb1af8498b523c7e80a02675035037884a2f1d0 Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing@HIDDEN>
Date: Sun, 28 Jul 2024 14:45:40 +0200
Subject: [PATCH] Always print commas and comma-ats specially with print-quoted

---
 src/print.c | 47 +++++++++++++++--------------------------------
 1 file changed, 15 insertions(+), 32 deletions(-)

diff --git a/src/print.c b/src/print.c
index 8f28b14e8b6..256f19aeb90 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2488,43 +2488,26 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
 	  && print_depth > XFIXNUM (Vprint_level))
 	print_c_string ("...", printcharfun);
       else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
-	       && EQ (XCAR (obj), Qquote))
+	       && (EQ (XCAR (obj), Qquote) ||
+		   EQ (XCAR (obj), Qfunction) ||
+		   EQ (XCAR (obj), Qbackquote) ||
+		   EQ (XCAR (obj), Qcomma) ||
+		   EQ (XCAR (obj), Qcomma_at)))
 	{
-	  printchar ('\'', printcharfun);
+	  if (EQ (XCAR (obj), Qquote))
+	    printchar ('\'', printcharfun);
+	  else if (EQ (XCAR (obj), Qfunction))
+	    print_c_string("#'", printcharfun);
+          else if (EQ (XCAR (obj), Qbackquote))
+	    printchar ('`', printcharfun);
+          else if (EQ (XCAR (obj), Qcomma))
+	    printchar (',', printcharfun);
+          else if (EQ (XCAR (obj), Qcomma_at))
+	    print_c_string (",@", printcharfun);
 	  obj = XCAR (XCDR (obj));
 	  --print_depth;	/* tail recursion */
 	  goto print_obj;
 	}
-      else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
-	       && EQ (XCAR (obj), Qfunction))
-	{
-	  print_c_string ("#'", printcharfun);
-	  obj = XCAR (XCDR (obj));
-	  --print_depth;	/* tail recursion */
-	  goto print_obj;
-	}
-      /* FIXME: Do we really need the new_backquote_output gating of
-	 special syntax for comma and comma-at?  There is basically no
-	 benefit from it at all, and it would be nice to get rid of
-	 the recursion here without additional complexity.  */
-      else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
-	       && EQ (XCAR (obj), Qbackquote))
-	{
-	  printchar ('`', printcharfun);
-	  new_backquote_output++;
-	  print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
-	  new_backquote_output--;
-	}
-      else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
-	       && (EQ (XCAR (obj), Qcomma)
-		   || EQ (XCAR (obj), Qcomma_at))
-	       && new_backquote_output)
-	{
-	  print_object (XCAR (obj), printcharfun, false);
-	  new_backquote_output--;
-	  print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
-	  new_backquote_output++;
-	}
       else
 	{
 	  printchar ('(', printcharfun);
-- 
2.44.2


--=-=-=--




Acknowledgement sent to Thuna <thuna.cing@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#72334; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

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