bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71601: 29.1; force-mode-line-update does not refresh names of tab-li


From: Juri Linkov
Subject: bug#71601: 29.1; force-mode-line-update does not refresh names of tab-lines
Date: Mon, 17 Jun 2024 09:11:01 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> (progn
>   (tab-line-mode)
>   (setq-local tab-line-tab-name-function
>             (defun my/tab-name(tab &optional _)
>               (with-current-buffer tab
>                   (concat (buffer-name) " " (format-time-string "%S"))))))
>
> This works fine and I get the seconds after the buffer-name.  However,
> I seem to have no way of updating the tab-line to cause the names to
> be refreshed (except to add or remove a tab).
> The documentation of `force-mode-line-update` and the `:set` code of
> `tab-line-tab-name-function` suggest that calling
> `(force-mode-line-update t)` would do the trick, but on my Emacs, this
> does not work.  Is this a bug or am I misunderstanding the
> documentation?

Please try to set `tab-line-cache-key-function` to a function
that is a copy of `tab-line-cache-key-default` but where
at the end there is appended your addition of (format-time-string "%S"):

(setq tab-line-cache-key-function
      (lambda (tabs)
        (list
         tabs
         ;; handle buffer renames
         (buffer-name (window-buffer))
         ;; handle tab-line scrolling
         (window-parameter nil 'tab-line-hscroll)
         ;; for setting face 'tab-line-tab-current'
         (mode-line-window-selected-p)
         ;; for `tab-line-tab-face-modified'
         (and (memq 'tab-line-tab-face-modified
                    tab-line-tab-face-functions)
              (buffer-file-name)
              (buffer-modified-p))
         ;; Added key:
         (format-time-string "%S"))))

This will clear the cache every time when (format-time-string "%S")
changes, i.e. every second.

If this works, please suggest where would you expect to find this information.
Should the documentation be updated for 'tab-line-tab-name-function'?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]