changeset 44559:a7ca9a83f673

(display_mode_element): Don't let mode_line_proptrans_alist grow without limit. Move recently used elements to the front.
author Richard M. Stallman <rms@gnu.org>
date Sat, 13 Apr 2002 17:46:37 +0000
parents a22b230e0b6c
children 0fddc27db9ae
files src/xdisp.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Sat Apr 13 13:01:48 2002 +0000
+++ b/src/xdisp.c	Sat Apr 13 17:46:37 2002 +0000
@@ -13695,15 +13695,28 @@
 
 		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);
 		  }
 	      }
 	  }