]> code.delx.au - gnu-emacs/commitdiff
(display_mode_element): Don't let mode_line_proptrans_alist
authorRichard M. Stallman <rms@gnu.org>
Sat, 13 Apr 2002 17:46:37 +0000 (17:46 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 13 Apr 2002 17:46:37 +0000 (17:46 +0000)
grow without limit.  Move recently used elements to the front.

src/xdisp.c

index 107218b928ba23e727b90202836d8741f8467d81..53770a4b13838d41b1bd86f6f2f3e2b998ae3158 100644 (file)
@@ -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);
                  }
              }
          }