From bdb1af8498b523c7e80a02675035037884a2f1d0 Mon Sep 17 00:00:00 2001 From: Thuna 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