From: Stefan Monnier Date: Fri, 20 Apr 2012 13:02:20 +0000 (-0400) Subject: * src/print.c (print_preprocess): Only check print_depth if print-circle X-Git-Tag: emacs-24.2.90~471^2~332 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4ae29f89bec2dda2c891bba212d1918b1375421b;p=emacs.git * 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index fa6c47bf955..a6fcc80da8a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-04-20 Stefan Monnier + + * 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 * 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 (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 2012-04-18 Paul Eggert @@ -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 diff --git a/src/print.c b/src/print.c index dac7a79d599..b8ee44d0d10 100644 --- a/src/print.c +++ b/src/print.c @@ -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; - 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 + /* 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)) { - /* 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; } } }