Subject: Re: bug#60340: 29.0.60; force-mode-line-update does not update tab line

From: Eli Zaretskii <[email-masked]>
Date: Mon, 26 Dec 2022 19:04:33 +0200

> From: Aaron Jensen <[email-masked]>
> Date: Mon, 26 Dec 2022 11:40:33 -0500
> 
> 
> (defun random-name (_buffer &optional _buffers)
>   (format "tab %d" (random 1000)))
> (setq tab-line-tab-name-function #'random-name)
> (tab-line-mode)
> 
> Then, eval:
> 
> (force-mode-line-update)
> 
> Every time that evals, I believe you should see the tab name update, but
> it does not. This makes it impossible to change tab names without
> changing buffer names as far as I can tell. There is likely something
> I'm missing, but per the docs, I believe force-mode-line-update should
> update tab lines. Passing `t' as ALL does not work either.

force-mode-line-update updates what's displayed on the line, but it
doesn't recompute tab-line-format.  And that is what you want to do:
you customize tab-line-tab-name-function, which affects
tab-line-format.

IOW, if your format has %d, and %d formats some number which changes
with time, then you can expect that force-mode-line-update will cause
a different string be displayed instead of %d.  But you _cannot_
expect that the format string which includes %d will be recalculated
just because you called force-mode-line-update.

If you want the displayed values to change when the line is
redisplayed, you need to use :eval or somesuch.