# HG changeset patch # User Richard M. Stallman # Date 1034559026 0 # Node ID c63e966719630f0823ef8b607b97543ee3555e00 # Parent 9925c06ca5fb219c57933ea3f49eb1e5f2b7d921 (print): When backquote form is the car of a list, output in old style. Use old_backquote_output to output all comma forms inside it in old style too. diff -r 9925c06ca5fb -r c63e96671963 src/print.c --- a/src/print.c Mon Oct 14 01:28:36 2002 +0000 +++ b/src/print.c Mon Oct 14 01:30:26 2002 +0000 @@ -91,6 +91,9 @@ /* Avoid actual stack overflow in print. */ int print_depth; +/* Nonzero if inside outputting backquote in old style. */ +int old_backquote_output; + /* Detect most circularities to print finite output. */ #define PRINT_CIRCLE 200 Lisp_Object being_printed[PRINT_CIRCLE]; @@ -1154,6 +1157,7 @@ int escapeflag; { print_depth = 0; + old_backquote_output = 0; /* Reset print_number_index and Vprint_number_table only when the variable Vprint_continuous_numbering is nil. Otherwise, @@ -1582,6 +1586,7 @@ print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); } else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) + && ! old_backquote_output && ((EQ (XCAR (obj), Qbackquote) || EQ (XCAR (obj), Qcomma) || EQ (XCAR (obj), Qcomma_at) @@ -1593,6 +1598,29 @@ else { PRINTCHAR ('('); + + /* If the first element is a backquote form, + print it old-style so it won't be misunderstood. */ + if (print_quoted && CONSP (XCAR (obj)) + && CONSP (XCDR (XCAR (obj))) + && NILP (XCDR (XCDR (XCAR (obj)))) + && EQ (XCAR (XCAR (obj)), Qbackquote)) + { + Lisp_Object tem; + tem = XCAR (obj); + PRINTCHAR ('('); + + print_object (Qbackquote, printcharfun, 0); + PRINTCHAR (' '); + + ++old_backquote_output; + print_object (XCAR (XCDR (tem)), printcharfun, 0); + --old_backquote_output; + PRINTCHAR (')'); + + obj = XCDR (obj); + } + { int print_length, i; Lisp_Object halftail = obj;