aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman2002-10-14 01:30:26 +0000
committerRichard M. Stallman2002-10-14 01:30:26 +0000
commit0330bb60a174b5307e3550f2c0c3ac0882219291 (patch)
tree0625cde34a0693da59fa98d0e43fc7ee2128dc27 /src
parent5da10d404b53cfffee1b6d8469e3ea674a739258 (diff)
downloademacs-0330bb60a174b5307e3550f2c0c3ac0882219291.tar.gz
emacs-0330bb60a174b5307e3550f2c0c3ac0882219291.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/print.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c
index 038a9aaeaa4..6c85c24cbe5 100644
--- a/src/print.c
+++ b/src/print.c
@@ -91,6 +91,9 @@ Lisp_Object Vfloat_output_format, Qfloat_output_format;
91/* Avoid actual stack overflow in print. */ 91/* Avoid actual stack overflow in print. */
92int print_depth; 92int print_depth;
93 93
94/* Nonzero if inside outputting backquote in old style. */
95int old_backquote_output;
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
96Lisp_Object being_printed[PRINT_CIRCLE]; 99Lisp_Object being_printed[PRINT_CIRCLE];
@@ -1154,6 +1157,7 @@ print (obj, printcharfun, escapeflag)
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,
@@ -1582,6 +1586,7 @@ print_object (obj, printcharfun, escapeflag)
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)
@@ -1593,6 +1598,29 @@ print_object (obj, printcharfun, escapeflag)
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;