From: Richard M. Stallman Date: Sat, 13 Apr 2002 17:46:37 +0000 (+0000) Subject: (display_mode_element): Don't let mode_line_proptrans_alist X-Git-Tag: ttn-vms-21-2-B4~15640 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=adb63af12a7ad22e19b6d3ae45ddff768a5e86d1;p=emacs.git (display_mode_element): Don't let mode_line_proptrans_alist grow without limit. Move recently used elements to the front. --- diff --git a/src/xdisp.c b/src/xdisp.c index 107218b928b..53770a4b138 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13695,15 +13695,28 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) aelt = Fassoc (elt, mode_line_proptrans_alist); if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt)))) - elt = XCAR (aelt); + { + mode_line_proptrans_alist + = Fcons (aelt, Fdelq (aelt, mode_line_proptrans_alist)); + elt = XCAR (aelt); + } else { + Lisp_Object tem; + elt = Fcopy_sequence (elt); Fset_text_properties (make_number (0), Flength (elt), props, elt); + /* Add this item to mode_line_proptrans_alist. */ mode_line_proptrans_alist = Fcons (Fcons (elt, props), mode_line_proptrans_alist); + /* Truncate mode_line_proptrans_alist + to at most 50 elements. */ + tem = Fnthcdr (make_number (50), + mode_line_proptrans_alist); + if (! NILP (tem)) + XSETCDR (tem, Qnil); } } }