Subject: Re: bug#33740: [PATCH] Customizable flymake mode-line indicator

From: Eli Zaretskii <[email-masked]>
Date: Thu, 19 Sep 2019 20:26:17 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Thu, 19 Sep 2019 18:23:01 +0200
> 
> Lars Ingebrigtsen <[email-masked]> writes:
> 
> > But the code in that function could be clearer -- I don't really
> > understand why this is done at all.
> 
> 		aelt = Fassoc (elt, mode_line_proptrans_alist, Qnil);
> 		if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt))))
> 		  {
> 		    /* AELT is what we want.  Move it to the front
> 		       without consing.  */
> 		    elt = XCAR (aelt);
> 		    mode_line_proptrans_alist
> 		      = move_elt_to_front (aelt, mode_line_proptrans_alist);
> 		  }
> 		else
> 		  {
> 		    Lisp_Object tem;
> 
> 		    /* If AELT has the wrong props, it is useless.
> 		       so get rid of it.  */
> 
> 
> Oh, this entire thing is just so that we can maintain a cache of text
> properties and avoid some consing?  And if we have a cache, then all the
> characters in the element has to have the same text properties.

Yes.

> I wonder whether all this is really warranted...

It is.  Redrawing the mode line is a very frequent redisplay thing, so
optimizing the heck out of it is justified.

That's what I meant when I said "wisely": you need to create faces in
advance, and take care to have each individual string you use to be of
a uniform face.  And don't use propertize.