Mercurial > emacs
comparison src/print.c @ 47864:c63e96671963
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 14 Oct 2002 01:30:26 +0000 |
parents | 0055228ad95f |
children | 23a1cea22d13 |
comparison
equal
deleted
inserted
replaced
47863:9925c06ca5fb | 47864:c63e96671963 |
---|---|
88 #define DOUBLE_DIGITS_BOUND ((int) ceil (log10 (pow (FLT_RADIX, DBL_MANT_DIG)))) | 88 #define DOUBLE_DIGITS_BOUND ((int) ceil (log10 (pow (FLT_RADIX, DBL_MANT_DIG)))) |
89 #endif | 89 #endif |
90 | 90 |
91 /* Avoid actual stack overflow in print. */ | 91 /* Avoid actual stack overflow in print. */ |
92 int print_depth; | 92 int print_depth; |
93 | |
94 /* Nonzero if inside outputting backquote in old style. */ | |
95 int old_backquote_output; | |
93 | 96 |
94 /* Detect most circularities to print finite output. */ | 97 /* Detect most circularities to print finite output. */ |
95 #define PRINT_CIRCLE 200 | 98 #define PRINT_CIRCLE 200 |
96 Lisp_Object being_printed[PRINT_CIRCLE]; | 99 Lisp_Object being_printed[PRINT_CIRCLE]; |
97 | 100 |
1152 Lisp_Object obj; | 1155 Lisp_Object obj; |
1153 register Lisp_Object printcharfun; | 1156 register Lisp_Object printcharfun; |
1154 int escapeflag; | 1157 int escapeflag; |
1155 { | 1158 { |
1156 print_depth = 0; | 1159 print_depth = 0; |
1160 old_backquote_output = 0; | |
1157 | 1161 |
1158 /* Reset print_number_index and Vprint_number_table only when | 1162 /* Reset print_number_index and Vprint_number_table only when |
1159 the variable Vprint_continuous_numbering is nil. Otherwise, | 1163 the variable Vprint_continuous_numbering is nil. Otherwise, |
1160 the values of these variables will be kept between several | 1164 the values of these variables will be kept between several |
1161 print functions. */ | 1165 print functions. */ |
1580 PRINTCHAR ('#'); | 1584 PRINTCHAR ('#'); |
1581 PRINTCHAR ('\''); | 1585 PRINTCHAR ('\''); |
1582 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); | 1586 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); |
1583 } | 1587 } |
1584 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) | 1588 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) |
1589 && ! old_backquote_output | |
1585 && ((EQ (XCAR (obj), Qbackquote) | 1590 && ((EQ (XCAR (obj), Qbackquote) |
1586 || EQ (XCAR (obj), Qcomma) | 1591 || EQ (XCAR (obj), Qcomma) |
1587 || EQ (XCAR (obj), Qcomma_at) | 1592 || EQ (XCAR (obj), Qcomma_at) |
1588 || EQ (XCAR (obj), Qcomma_dot)))) | 1593 || EQ (XCAR (obj), Qcomma_dot)))) |
1589 { | 1594 { |
1591 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); | 1596 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); |
1592 } | 1597 } |
1593 else | 1598 else |
1594 { | 1599 { |
1595 PRINTCHAR ('('); | 1600 PRINTCHAR ('('); |
1601 | |
1602 /* If the first element is a backquote form, | |
1603 print it old-style so it won't be misunderstood. */ | |
1604 if (print_quoted && CONSP (XCAR (obj)) | |
1605 && CONSP (XCDR (XCAR (obj))) | |
1606 && NILP (XCDR (XCDR (XCAR (obj)))) | |
1607 && EQ (XCAR (XCAR (obj)), Qbackquote)) | |
1608 { | |
1609 Lisp_Object tem; | |
1610 tem = XCAR (obj); | |
1611 PRINTCHAR ('('); | |
1612 | |
1613 print_object (Qbackquote, printcharfun, 0); | |
1614 PRINTCHAR (' '); | |
1615 | |
1616 ++old_backquote_output; | |
1617 print_object (XCAR (XCDR (tem)), printcharfun, 0); | |
1618 --old_backquote_output; | |
1619 PRINTCHAR (')'); | |
1620 | |
1621 obj = XCDR (obj); | |
1622 } | |
1623 | |
1596 { | 1624 { |
1597 int print_length, i; | 1625 int print_length, i; |
1598 Lisp_Object halftail = obj; | 1626 Lisp_Object halftail = obj; |
1599 | 1627 |
1600 /* Negative values of print-length are invalid in CL. | 1628 /* Negative values of print-length are invalid in CL. |