Subject: Re: bug#72334: [PATCH] Always print commas and comma-ats specially

From: Thuna <[email-masked]>
Date: Wed, 12 Feb 2025 01:06:45 +0100

> Thanks.
>
> Thuna, I didn't study your patch very deeply yet but the first thing
> that stands out is that there are no tests.  Any chance you could look
> into that?

Sure.  It's somewhat late here so I'll write those tomorrow.  What
should quote and function do?  That is, should it be (foo . 'bar) or
(foo quote bar)?

The important thing is, though, I actually took a look at the patch
since it's been a while, and I was wrong, what I explained was bug
72434, which I've also attached here.

This patch _actually_ makes it so that (\, foo) [and (\,@ foo)] is
printed as ",foo" in every context, whereas it current prints like that
only if we are inside a quasiquoted form [that is, (\` (\, (\, foo))
prints as "`,(\, foo)"].

[If you're trying the other patch, I should note here as well that that
one builds on top of this one, so the results are incorrect if you only
apply that.  Specifically, when we're not in a backquote, (foo . ,bar)
prints as (foo . (\, bar)) instead.]

>From 4cea5d48a772870df40f7d33fc0a87cdcfc9bbc1 Mon Sep 17 00:00:00 2001
From: Thuna <[email-masked]>
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