Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion

From: Eli Zaretskii <[email-masked]>
Date: Thu, 24 Aug 2023 08:29:13 +0300

> Date: Thu, 24 Aug 2023 04:54:44 +0300
> Cc: [email-masked]
> From: Dmitry Gutov <[email-masked]>
> 
> On 05/06/2023 14:23, Eli Zaretskii wrote:
> >> +                (format-mode-line mode-line-process nil nil buf)))
> > Do you really need to call format-mode-line?  My advice is to stay
> > away of that function: it could have unpleasant side effects.
> 
> Does calling format-mode-line trigger extra redisplays or something? 
> That sounds unexpected.

It reuses parts of the redisplay's code, yes.  Depending what's in the
format variable passed to format-mode-line, that could cause a variety
of surprises, especially if :eval forms are involved.  It could also
temporarily select another window and/or buffer, if the respective
arguments are not omitted, which could also be unexpected.

IMO, this function should be used sparing and with caution.