aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2012-04-20 09:02:20 -0400
committerStefan Monnier2012-04-20 09:02:20 -0400
commit4ae29f89bec2dda2c891bba212d1918b1375421b (patch)
treee88d5ae1bd5006112ff9d4ab02a5379ce948e3f6 /src
parent39773899f380fd6bd5628f537f56c858cbe25656 (diff)
downloademacs-4ae29f89bec2dda2c891bba212d1918b1375421b.tar.gz
emacs-4ae29f89bec2dda2c891bba212d1918b1375421b.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog16
-rw-r--r--src/print.c90
2 files changed, 56 insertions, 50 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fa6c47bf955..a6fcc80da8a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12012-04-20 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * print.c (print_preprocess): Only check print_depth if print-circle
4 is nil.
5 (print_object): Check for cycles even when print-circle is nil and
6 print-gensym is t, but only check print_depth if print-circle is nil.
7
12012-04-20 Chong Yidong <cyd@gnu.org> 82012-04-20 Chong Yidong <cyd@gnu.org>
2 9
3 * process.c (wait_reading_process_output): If EIO occurs on a pty, 10 * process.c (wait_reading_process_output): If EIO occurs on a pty,
@@ -16,13 +23,14 @@
16 (set_cursor_from_row): If called for a mode-line or header-line 23 (set_cursor_from_row): If called for a mode-line or header-line
17 row, return zero immediately. 24 row, return zero immediately.
18 (try_cursor_movement): If inside continuation line, don't back up 25 (try_cursor_movement): If inside continuation line, don't back up
19 farther than the first row after the header line, if any. Don't 26 farther than the first row after the header line, if any.
20 consider the header-line row as "partially visible", even if 27 Don't consider the header-line row as "partially visible", even if
21 MATRIX_ROW_PARTIALLY_VISIBLE_P returns non-zero. (Bug#11261) 28 MATRIX_ROW_PARTIALLY_VISIBLE_P returns non-zero. (Bug#11261)
22 29
232012-04-20 Atsuo Ohki <ohki@gssm.otsuka.tsukuba.ac.jp> (tiny change) 302012-04-20 Atsuo Ohki <ohki@gssm.otsuka.tsukuba.ac.jp> (tiny change)
24 31
25 * lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n" (bug#11238). 32 * lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n"
33 (bug#11238).
26 34
272012-04-20 Teodor Zlatanov <tzz@lifelogs.com> 352012-04-20 Teodor Zlatanov <tzz@lifelogs.com>
282012-04-18 Paul Eggert <eggert@cs.ucla.edu> 362012-04-18 Paul Eggert <eggert@cs.ucla.edu>
@@ -91,7 +99,7 @@
91 (union aligned_Lisp_Misc): Define. 99 (union aligned_Lisp_Misc): Define.
92 (MARKER_BLOCK_SIZE, struct marker_block): Use union 100 (MARKER_BLOCK_SIZE, struct marker_block): Use union
93 aligned_Lisp_Misc instead of union Lisp_Misc. 101 aligned_Lisp_Misc instead of union Lisp_Misc.
94 (Fmake_symbol, allocate_misc, gc_sweep): Adjust 102 (Fmake_symbol, allocate_misc, gc_sweep): Adjust.
95 103
962012-04-14 Paul Eggert <eggert@cs.ucla.edu> 1042012-04-14 Paul Eggert <eggert@cs.ucla.edu>
97 105
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);
93int print_output_debug_flag EXTERNALLY_VISIBLE = 1; 93int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
94 94
95 95
96/* Low level output routines for characters and strings */ 96/* Low level output routines for characters and strings. */
97 97
98/* Lisp functions to do output using a stream 98/* Lisp functions to do output using a stream
99 must have the stream in a variable called printcharfun 99 must have the stream in a variable called printcharfun
100 and must start with PRINTPREPARE, end with PRINTFINISH, 100 and must start with PRINTPREPARE, end with PRINTFINISH,
101 and use PRINTDECLARE to declare common variables. 101 and use PRINTDECLARE to declare common variables.
102 Use PRINTCHAR to output one character, 102 Use PRINTCHAR to output one character,
103 or call strout to output a block of characters. */ 103 or call strout to output a block of characters. */
104 104
105#define PRINTDECLARE \ 105#define PRINTDECLARE \
106 struct buffer *old = current_buffer; \ 106 struct buffer *old = current_buffer; \
@@ -1130,15 +1130,15 @@ print_preprocess (Lisp_Object obj)
1130 int loop_count = 0; 1130 int loop_count = 0;
1131 Lisp_Object halftail; 1131 Lisp_Object halftail;
1132 1132
1133 /* Give up if we go so deep that print_object will get an error. */
1134 /* See similar code in print_object. */
1135 if (print_depth >= PRINT_CIRCLE)
1136 error ("Apparently circular structure being printed");
1137
1138 /* Avoid infinite recursion for circular nested structure 1133 /* Avoid infinite recursion for circular nested structure
1139 in the case where Vprint_circle is nil. */ 1134 in the case where Vprint_circle is nil. */
1140 if (NILP (Vprint_circle)) 1135 if (NILP (Vprint_circle))
1141 { 1136 {
1137 /* Give up if we go so deep that print_object will get an error. */
1138 /* See similar code in print_object. */
1139 if (print_depth >= PRINT_CIRCLE)
1140 error ("Apparently circular structure being printed");
1141
1142 for (i = 0; i < print_depth; i++) 1142 for (i = 0; i < print_depth; i++)
1143 if (EQ (obj, being_printed[i])) 1143 if (EQ (obj, being_printed[i]))
1144 return; 1144 return;
@@ -1240,7 +1240,7 @@ static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object stri
1240#define PRINT_STRING_NON_CHARSET_FOUND 1 1240#define PRINT_STRING_NON_CHARSET_FOUND 1
1241#define PRINT_STRING_UNSAFE_CHARSET_FOUND 2 1241#define PRINT_STRING_UNSAFE_CHARSET_FOUND 2
1242 1242
1243/* Bitwise or of the above macros. */ 1243/* Bitwise or of the above macros. */
1244static int print_check_string_result; 1244static int print_check_string_result;
1245 1245
1246static void 1246static void
@@ -1323,48 +1323,46 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1323 1323
1324 QUIT; 1324 QUIT;
1325 1325
1326 /* See similar code in print_preprocess. */
1327 if (print_depth >= PRINT_CIRCLE)
1328 error ("Apparently circular structure being printed");
1329
1330 /* Detect circularities and truncate them. */ 1326 /* Detect circularities and truncate them. */
1331 if (PRINT_CIRCLE_CANDIDATE_P (obj)) 1327 if (NILP (Vprint_circle))
1332 { 1328 {
1333 if (NILP (Vprint_circle) && NILP (Vprint_gensym)) 1329 /* Simple but incomplete way. */
1334 { 1330 int i;
1335 /* Simple but incomplete way. */ 1331
1336 int i; 1332 /* See similar code in print_preprocess. */
1337 for (i = 0; i < print_depth; i++) 1333 if (print_depth >= PRINT_CIRCLE)
1338 if (EQ (obj, being_printed[i])) 1334 error ("Apparently circular structure being printed");
1339 { 1335
1340 sprintf (buf, "#%d", i); 1336 for (i = 0; i < print_depth; i++)
1341 strout (buf, -1, -1, printcharfun); 1337 if (EQ (obj, being_printed[i]))
1342 return; 1338 {
1343 } 1339 sprintf (buf, "#%d", i);
1344 being_printed[print_depth] = obj; 1340 strout (buf, -1, -1, printcharfun);
1345 } 1341 return;
1346 else 1342 }
1343 being_printed[print_depth] = obj;
1344 }
1345 else if (PRINT_CIRCLE_CANDIDATE_P (obj))
1346 {
1347 /* With the print-circle feature. */
1348 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
1349 if (INTEGERP (num))
1347 { 1350 {
1348 /* With the print-circle feature. */ 1351 EMACS_INT n = XINT (num);
1349 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil); 1352 if (n < 0)
1350 if (INTEGERP (num)) 1353 { /* Add a prefix #n= if OBJ has not yet been printed;
1354 that is, its status field is nil. */
1355 sprintf (buf, "#%"pI"d=", -n);
1356 strout (buf, -1, -1, printcharfun);
1357 /* OBJ is going to be printed. Remember that fact. */
1358 Fputhash (obj, make_number (- n), Vprint_number_table);
1359 }
1360 else
1351 { 1361 {
1352 EMACS_INT n = XINT (num); 1362 /* Just print #n# if OBJ has already been printed. */
1353 if (n < 0) 1363 sprintf (buf, "#%"pI"d#", n);
1354 { /* Add a prefix #n= if OBJ has not yet been printed; 1364 strout (buf, -1, -1, printcharfun);
1355 that is, its status field is nil. */ 1365 return;
1356 sprintf (buf, "#%"pI"d=", -n);
1357 strout (buf, -1, -1, printcharfun);
1358 /* OBJ is going to be printed. Remember that fact. */
1359 Fputhash (obj, make_number (- n), Vprint_number_table);
1360 }
1361 else
1362 {
1363 /* Just print #n# if OBJ has already been printed. */
1364 sprintf (buf, "#%"pI"d#", n);
1365 strout (buf, -1, -1, printcharfun);
1366 return;
1367 }
1368 } 1366 }
1369 } 1367 }
1370 } 1368 }