I would like the title my frames to show "<name of tab>: <name of buffer in active window>".

Presently, frame-title-format has its default value of %b, which shows only the name of the buffer in the selected window. There does not appear to be a percent-code for the current tab name.

I can use set-frame-parameter to assign a value for the name of the frame. The name of the current tab is easily found using tab-bar--current-tab. It is easy enough to concatenate the name of that tab to the name-of-buffer-in-active-window. But, that's a one-time execution. The frame title does not auto-update when the focus shifts to a different window within the frame.

How can I include the tab name while maintaining auto-update of the buffer name for the currently selected window?

1 Answer 1


Auto-updating on every window switch in a hook would be too irrational. Better would be to include an eval form in frame-title-format like:

(setq frame-title-format
      '((:eval (if tab-bar-mode
                   (cdr (assq 'name (tab-bar--current-tab))) ""))
        ": %b"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.