GNU bug report logs - #71601
29.1; force-mode-line-update does not refresh names of tab-lines

Previous Next

Package: emacs;

Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>

Date: Sun, 16 Jun 2024 22:59:02 UTC

Severity: normal

Found in version 29.1

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 71601 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Cc: 71601 <at> debbugs.gnu.org
Subject: Re: bug#71601: 29.1; force-mode-line-update does not refresh names
 of tab-lines
Date: Mon, 17 Jun 2024 09:11:01 +0300
> (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'?




This bug report was last modified 1 year and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.