aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-04-27 19:09:17 +0000
committerGerd Moellmann2000-04-27 19:09:17 +0000
commit42ac1ed4d1f82f6b01efe9aaaa4756a4905050f8 (patch)
tree9db65bef17c899df7d1167061384ac9f4eb7269e /src
parent3ad6e32bb9ece447f29efdc0e735e2e5e26bc771 (diff)
downloademacs-42ac1ed4d1f82f6b01efe9aaaa4756a4905050f8.tar.gz
emacs-42ac1ed4d1f82f6b01efe9aaaa4756a4905050f8.zip
(print_object): Treat print-length < 0 as nil.
Diffstat (limited to 'src')
-rw-r--r--src/print.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/print.c b/src/print.c
index be2eee4e5cf..80a897fdb22 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1487,12 +1487,17 @@ print_object (obj, printcharfun, escapeflag)
1487 { 1487 {
1488 PRINTCHAR ('('); 1488 PRINTCHAR ('(');
1489 { 1489 {
1490 register int i = 0; 1490 int print_length, i;
1491 register int print_length = 0;
1492 Lisp_Object halftail = obj; 1491 Lisp_Object halftail = obj;
1493 1492
1494 if (INTEGERP (Vprint_length)) 1493 /* Negative values of print-length are illegal in CL.
1495 print_length = XINT (Vprint_length); 1494 Treat them like nil, as CMUCL does. */
1495 if (NATNUMP (Vprint_length))
1496 print_length = XFASTINT (Vprint_length);
1497 else
1498 print_length = 0;
1499
1500 i = 0;
1496 while (CONSP (obj)) 1501 while (CONSP (obj))
1497 { 1502 {
1498 /* Detect circular list. */ 1503 /* Detect circular list. */
@@ -1513,7 +1518,8 @@ print_object (obj, printcharfun, escapeflag)
1513 { 1518 {
1514 int i; 1519 int i;
1515 for (i = 0; i < print_number_index; i++) 1520 for (i = 0; i < print_number_index; i++)
1516 if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i), obj)) 1521 if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i),
1522 obj))
1517 { 1523 {
1518 if (NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i))) 1524 if (NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i)))
1519 { 1525 {
@@ -1529,24 +1535,31 @@ print_object (obj, printcharfun, escapeflag)
1529 } 1535 }
1530 } 1536 }
1531 } 1537 }
1538
1532 if (i++) 1539 if (i++)
1533 PRINTCHAR (' '); 1540 PRINTCHAR (' ');
1541
1534 if (print_length && i > print_length) 1542 if (print_length && i > print_length)
1535 { 1543 {
1536 strout ("...", 3, 3, printcharfun, 0); 1544 strout ("...", 3, 3, printcharfun, 0);
1537 goto end_of_list; 1545 goto end_of_list;
1538 } 1546 }
1547
1539 print_object (XCAR (obj), printcharfun, escapeflag); 1548 print_object (XCAR (obj), printcharfun, escapeflag);
1549
1540 obj = XCDR (obj); 1550 obj = XCDR (obj);
1541 if (!(i & 1)) 1551 if (!(i & 1))
1542 halftail = XCDR (halftail); 1552 halftail = XCDR (halftail);
1543 } 1553 }
1544 } 1554 }
1555
1556 /* OBJ non-nil here means it's the end of a dotted list. */
1545 if (!NILP (obj)) 1557 if (!NILP (obj))
1546 { 1558 {
1547 strout (" . ", 3, 3, printcharfun, 0); 1559 strout (" . ", 3, 3, printcharfun, 0);
1548 print_object (obj, printcharfun, escapeflag); 1560 print_object (obj, printcharfun, escapeflag);
1549 } 1561 }
1562
1550 end_of_list: 1563 end_of_list:
1551 PRINTCHAR (')'); 1564 PRINTCHAR (')');
1552 } 1565 }
@@ -1580,10 +1593,12 @@ print_object (obj, printcharfun, escapeflag)
1580 strout (buf, -1, -1, printcharfun, 0); 1593 strout (buf, -1, -1, printcharfun, 0);
1581 PRINTCHAR ('\"'); 1594 PRINTCHAR ('\"');
1582 1595
1583 /* Don't print more characters than the specified maximum. */ 1596 /* Don't print more characters than the specified maximum.
1584 if (INTEGERP (Vprint_length) 1597 Negative values of print-length are illegal. Treat them
1585 && XINT (Vprint_length) < size_in_chars) 1598 like a print-length of nil. */
1586 size_in_chars = XINT (Vprint_length); 1599 if (NATNUMP (Vprint_length)
1600 && XFASTINT (Vprint_length) < size_in_chars)
1601 size_in_chars = XFASTINT (Vprint_length);
1587 1602
1588 for (i = 0; i < size_in_chars; i++) 1603 for (i = 0; i < size_in_chars; i++)
1589 { 1604 {
@@ -1703,9 +1718,9 @@ print_object (obj, printcharfun, escapeflag)
1703 register Lisp_Object tem; 1718 register Lisp_Object tem;
1704 1719
1705 /* Don't print more elements than the specified maximum. */ 1720 /* Don't print more elements than the specified maximum. */
1706 if (INTEGERP (Vprint_length) 1721 if (NATNUMP (Vprint_length)
1707 && XINT (Vprint_length) < size) 1722 && XFASTINT (Vprint_length) < size)
1708 size = XINT (Vprint_length); 1723 size = XFASTINT (Vprint_length);
1709 1724
1710 for (i = 0; i < size; i++) 1725 for (i = 0; i < size; i++)
1711 { 1726 {