# HG changeset patch # User Andreas Schwab # Date 1252687568 0 # Node ID eee8cf0c23f045d5af3c74534c94401f97111a31 # Parent d04ef26eaf27879a37d09ec46c1f0b927e49d400 (display_mode_element): Detect cycles. diff -r d04ef26eaf27 -r eee8cf0c23f0 src/ChangeLog --- a/src/ChangeLog Fri Sep 11 12:05:45 2009 +0000 +++ b/src/ChangeLog Fri Sep 11 16:46:08 2009 +0000 @@ -1,3 +1,7 @@ +2009-09-11 Andreas Schwab + + * xdisp.c (display_mode_element): Detect cycles. + 2009-09-11 Stefan Monnier * keymap.c (where_is_internal): Don't erroneously return nil right after diff -r d04ef26eaf27 -r eee8cf0c23f0 src/xdisp.c --- a/src/xdisp.c Fri Sep 11 12:05:45 2009 +0000 +++ b/src/xdisp.c Fri Sep 11 16:46:08 2009 +0000 @@ -17750,14 +17750,10 @@ } else if (STRINGP (car) || CONSP (car)) { - register int limit = 5000; - /* Limit is to protect against circular lists. - The limit used to be 50, but if you use enough minor modes, - minor-mode-alist will easily grow past 50. Circular lists - are rather unlikely, so it's better for the limit to be - "too large" rather than "too small". */ + Lisp_Object halftail = elt; + int len = 0; + while (CONSP (elt) - && --limit > 0 && (precision <= 0 || n < precision)) { n += display_mode_element (it, depth, @@ -17769,6 +17765,12 @@ precision - n, XCAR (elt), props, risky); elt = XCDR (elt); + len++; + if ((len & 1) == 0) + halftail = XCDR (halftail); + /* Check for cycle. */ + if (EQ (halftail, elt)) + break; } } }