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

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

bug#57848: 29.0.50; Problems with private tab-line-tab-name-function


From: Michael Heerdegen
Subject: bug#57848: 29.0.50; Problems with private tab-line-tab-name-function
Date: Fri, 16 Sep 2022 06:39:56 +0200

Hello,

(1) When using `tab-line-mode' together with

#+begin_src emacs-lisp
(setq-local tab-line-tab-name-function
            (lambda (_b &optional _bs) "%b"))
#+end_src

I get tabs that are all named equally - all named after the currently
active tab's buffer.

I didn't know that mode-line format sequences are valid.  Are they?  If
they are (would be nice), could we document this, fix the behavior (I
guess the interpretation is done in the context of a wrong current
buffer), and maybe allow all kinds of mode-line-format values, like
lists?

If the interpretation of mode-line format specs is not intended, the
above example should just lead to a literal "%b" tab name.  We would
need to add according escape characters then.


(2) What I actually had tried was to get nicely named tabs for Info
buffers (including the clones created with M-n).

I tried with something like this:

#+begin_src emacs-lisp
(add-hook 'Info-mode-hook
          (defun my-setup-tab-line-for-Info-mode ()
            (tab-line-mode +1)
            (setq-local
             tab-line-tab-name-function
             (lambda (b &optional _bs)
               (with-current-buffer b
                 (apply
                  #'concat
                  (cdr mode-line-buffer-identification)))))))
#+end_src

but with that the tab names are not updated while browsing Info pages.

The problem here seems to be related to the caching mechanism that
doesn't recognize the need to update; invalidating the cache explicitly
like with this very ugly hack:

#+begin_src emacs-lisp
(add-variable-watcher
 'mode-line-buffer-identification
 (defun my-Info-mode-line-buffer-identification-watcher
     (_symbol _newval _operation where)
   (when (and (eq where (current-buffer))
              (derived-mode-p 'Info-mode))
     (set-window-parameter nil 'tab-line-cache nil))))
#+end_src

makes it work.

It would be nice to provide a way to get cases like this work , e.g. by
allowing to specify buffer-local cache key returning functions.

I didn't try the above stuff with the tab bar, but I guess similar
improvements could be implemented for that as well.

TIA,

Michael.


In GNU Emacs 29.0.50 (build 12, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw scroll bars) of 2022-09-16 built on drachen
Repository revision: 833e80a0ef115a3fdc20a9d9a3190caab3b56621
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)






reply via email to

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