I'm using tab-bar-mode in Emacs and noticed that, if there are a lot of tabs, then each tab shrink to accommodate the newer tabs.
What I want to do instead is for the tabs to remain on a fixed width/size, and then show newer tabs on the right side of the tab bar (from looking around, I think it's called "Tab Overflow"?). This is already done in different editor like Geany, so I wonder if there is a way to do it too in Emacs.
Here is my init.el
:
;; stop sounds
(setq visible-bell 1)
;; Open File
(global-set-key (kbd "C-o") 'find-file)
;; Save File
(global-set-key (kbd "C-s") 'save-buffer)
;; Cut
(global-set-key (kbd "C-x") 'kill-region)
;; Copy
(global-set-key (kbd "C-c") 'kill-ring-save)
;; Paste
(global-set-key (kbd "C-v") 'yank)
;; Undo
(global-set-key (kbd "C-z") 'undo)
;; Redo
(global-set-key (kbd "C-y") 'undo-tree-redo)
;; Find
(global-set-key (kbd "C-f") 'isearch-forward)
;; Replace
(global-set-key (kbd "C-h") 'query-replace)
;; Go to Line
(global-set-key (kbd "C-g") 'goto-line)
;; Select All
(global-set-key (kbd "C-a") 'mark-whole-buffer)
;; Duplicate Line
(global-set-key (kbd "C-d") (lambda () (interactive) (kill-whole-line) (yank) (yank)))
;; Switch between open files
(global-set-key (kbd "C-<prior>") 'previous-buffer) ; Ctrl + PageUp
(global-set-key (kbd "C-<next>") 'next-buffer) ; Ctrl + PageDown
;; Quit emacs
(global-set-key (kbd "C-q") 'save-buffers-kill-terminal)
;; Enable tab-bar-mode by default
(tab-bar-mode 1)
(defun new-tab ()
"Create a new tab with an untitled buffer."
(interactive)
(tab-new)
(switch-to-buffer (generate-new-buffer "untitled")))
(global-set-key (kbd "C-t") 'new-tab)
;; Close Tab
(global-set-key (kbd "C-w") 'tab-close)
;; Next Tab
(global-set-key (kbd "C-<next>") 'tab-next)
;; Previous Tab
(global-set-key (kbd "C-<prior>") 'tab-previous)
(setq tab-bar-show t)
I'm using Emacs 29.1 on Windows 10.
C-h v tab-bar-tabs-function
which allows you to define a custom function to return the list of tabs to be rendered. That function can then return some appropriate slice of the tabs which are actually available, depending on how you've "scrolled" that list (using custom commands which you would also write). – phils Sep 20 '23 at 12:23