diff options
author | Richard M. Stallman <rms@gnu.org> | 2002-10-14 01:30:26 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2002-10-14 01:30:26 +0000 |
commit | 0330bb60a174b5307e3550f2c0c3ac0882219291 (patch) | |
tree | 0625cde34a0693da59fa98d0e43fc7ee2128dc27 /src/print.c | |
parent | 5da10d404b53cfffee1b6d8469e3ea674a739258 (diff) | |
download | emacs-0330bb60a174b5307e3550f2c0c3ac0882219291.tar.gz |
(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/print.c')
-rw-r--r-- | src/print.c | 28 |
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; /* 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 @@ print (obj, printcharfun, escapeflag) 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 (obj, printcharfun, escapeflag) 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 @@ print_object (obj, printcharfun, escapeflag) 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; |