* src/print.c (print_preprocess): Only check print_depth if print-circle

is nil.
(print_object): Check for cycles even when print-circle is nil and
print-gensym is t, but only check print_depth if print-circle is nil.
This commit is contained in:
Stefan Monnier 2012-04-20 09:02:20 -04:00
parent 39773899f3
commit 4ae29f89be
2 changed files with 56 additions and 50 deletions

View file

@ -1,3 +1,10 @@
2012-04-20 Stefan Monnier <monnier@iro.umontreal.ca>
* print.c (print_preprocess): Only check print_depth if print-circle
is nil.
(print_object): Check for cycles even when print-circle is nil and
print-gensym is t, but only check print_depth if print-circle is nil.
2012-04-20 Chong Yidong <cyd@gnu.org>
* process.c (wait_reading_process_output): If EIO occurs on a pty,
@ -16,13 +23,14 @@
(set_cursor_from_row): If called for a mode-line or header-line
row, return zero immediately.
(try_cursor_movement): If inside continuation line, don't back up
farther than the first row after the header line, if any. Don't
consider the header-line row as "partially visible", even if
farther than the first row after the header line, if any.
Don't consider the header-line row as "partially visible", even if
MATRIX_ROW_PARTIALLY_VISIBLE_P returns non-zero. (Bug#11261)
2012-04-20 Atsuo Ohki <ohki@gssm.otsuka.tsukuba.ac.jp> (tiny change)
* lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n" (bug#11238).
* lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n"
(bug#11238).
2012-04-20 Teodor Zlatanov <tzz@lifelogs.com>
2012-04-18 Paul Eggert <eggert@cs.ucla.edu>
@ -91,7 +99,7 @@
(union aligned_Lisp_Misc): Define.
(MARKER_BLOCK_SIZE, struct marker_block): Use union
aligned_Lisp_Misc instead of union Lisp_Misc.
(Fmake_symbol, allocate_misc, gc_sweep): Adjust
(Fmake_symbol, allocate_misc, gc_sweep): Adjust.
2012-04-14 Paul Eggert <eggert@cs.ucla.edu>

View file

@ -93,14 +93,14 @@ static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
/* Low level output routines for characters and strings */
/* Low level output routines for characters and strings. */
/* Lisp functions to do output using a stream
must have the stream in a variable called printcharfun
and must start with PRINTPREPARE, end with PRINTFINISH,
and use PRINTDECLARE to declare common variables.
Use PRINTCHAR to output one character,
or call strout to output a block of characters. */
or call strout to output a block of characters. */
#define PRINTDECLARE \
struct buffer *old = current_buffer; \
@ -1130,15 +1130,15 @@ print_preprocess (Lisp_Object obj)
int loop_count = 0;
Lisp_Object halftail;
/* Give up if we go so deep that print_object will get an error. */
/* See similar code in print_object. */
if (print_depth >= PRINT_CIRCLE)
error ("Apparently circular structure being printed");
/* Avoid infinite recursion for circular nested structure
in the case where Vprint_circle is nil. */
if (NILP (Vprint_circle))
{
/* Give up if we go so deep that print_object will get an error. */
/* See similar code in print_object. */
if (print_depth >= PRINT_CIRCLE)
error ("Apparently circular structure being printed");
for (i = 0; i < print_depth; i++)
if (EQ (obj, being_printed[i]))
return;
@ -1240,7 +1240,7 @@ static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object stri
#define PRINT_STRING_NON_CHARSET_FOUND 1
#define PRINT_STRING_UNSAFE_CHARSET_FOUND 2
/* Bitwise or of the above macros. */
/* Bitwise or of the above macros. */
static int print_check_string_result;
static void
@ -1323,48 +1323,46 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
QUIT;
/* See similar code in print_preprocess. */
if (print_depth >= PRINT_CIRCLE)
error ("Apparently circular structure being printed");
/* Detect circularities and truncate them. */
if (PRINT_CIRCLE_CANDIDATE_P (obj))
if (NILP (Vprint_circle))
{
if (NILP (Vprint_circle) && NILP (Vprint_gensym))
/* Simple but incomplete way. */
int i;
/* See similar code in print_preprocess. */
if (print_depth >= PRINT_CIRCLE)
error ("Apparently circular structure being printed");
for (i = 0; i < print_depth; i++)
if (EQ (obj, being_printed[i]))
{
sprintf (buf, "#%d", i);
strout (buf, -1, -1, printcharfun);
return;
}
being_printed[print_depth] = obj;
}
else if (PRINT_CIRCLE_CANDIDATE_P (obj))
{
/* With the print-circle feature. */
Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
if (INTEGERP (num))
{
/* Simple but incomplete way. */
int i;
for (i = 0; i < print_depth; i++)
if (EQ (obj, being_printed[i]))
{
sprintf (buf, "#%d", i);
strout (buf, -1, -1, printcharfun);
return;
}
being_printed[print_depth] = obj;
}
else
{
/* With the print-circle feature. */
Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
if (INTEGERP (num))
EMACS_INT n = XINT (num);
if (n < 0)
{ /* Add a prefix #n= if OBJ has not yet been printed;
that is, its status field is nil. */
sprintf (buf, "#%"pI"d=", -n);
strout (buf, -1, -1, printcharfun);
/* OBJ is going to be printed. Remember that fact. */
Fputhash (obj, make_number (- n), Vprint_number_table);
}
else
{
EMACS_INT n = XINT (num);
if (n < 0)
{ /* Add a prefix #n= if OBJ has not yet been printed;
that is, its status field is nil. */
sprintf (buf, "#%"pI"d=", -n);
strout (buf, -1, -1, printcharfun);
/* OBJ is going to be printed. Remember that fact. */
Fputhash (obj, make_number (- n), Vprint_number_table);
}
else
{
/* Just print #n# if OBJ has already been printed. */
sprintf (buf, "#%"pI"d#", n);
strout (buf, -1, -1, printcharfun);
return;
}
/* Just print #n# if OBJ has already been printed. */
sprintf (buf, "#%"pI"d#", n);
strout (buf, -1, -1, printcharfun);
return;
}
}
}