Eli Zaretskii writes: > Thanks, but why do we need to make the value of this mode-line-element > property be the element itself? Why not give it some simple value, > like the ordinal number of the element (which should be incremented > whenever we process another element)? So we could call this property > mode-line-elt-number and assign the elements values 1, 2, 3, etc. Is casting the 'Lisp_Object' to a number acceptable here? Please have a look at the updated patch. I tried an incremental counter but gave up. Because 'display_mode_element' could be called recursively, we may have to change its signature or introduce a new global variable. That feels a bit less clean to me. > I'm concerned that having the elements themselves be values will > prevent them from being GC'd, which might increase the memory > pressure. By contrast, fixnums are immediate values that don't need > to be GC'ed, and the element itself will not have any references after > the mode line is processed. I thought all objects would be GC'd. Since fixnums are not, I guess now we do not need to remove the text property before displaying the string? Please let me know what you think and I will update the patch if needed.