all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Al Haji-Ali <abdo.haji.ali@gmail.com>
Cc: 71601@debbugs.gnu.org
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	[thread overview]
Message-ID: <868qz4152a.fsf@mail.linkov.net> (raw)
In-Reply-To: <m25xu8sdfp.fsf@gmail.com> (Al Haji-Ali's message of "Sun, 16 Jun 2024 23:58:02 +0100")

> (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	other threads:[~2024-06-17  6:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-16 22:58 bug#71601: 29.1; force-mode-line-update does not refresh names of tab-lines Al Haji-Ali
2024-06-17  6:11 ` Juri Linkov [this message]
2024-06-17  8:31   ` Al Haji-Ali
2024-06-17 16:49     ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=868qz4152a.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=71601@debbugs.gnu.org \
    --cc=abdo.haji.ali@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.