fix(emacs): Avoid unwanted tab behaviour

This commit is contained in:
Madeleine Sydney
2025-02-17 02:51:21 -07:00
parent 90d2e9584e
commit 7ab9610b6f

View File

@@ -36,9 +36,16 @@ given \"explicit names\" that are static."
"Show the tab-bar if it is not already visible. See
`syd-tab-bar-hide-tab-bar-h'."
(unless vim-tab-bar-mode
(vim-tab-bar-mode 1)))
(defun syd-tab-bar--switch-to-default-buffer-h (_tab)
(switch-to-buffer (funcall syd-tab-bar-default-buffer-function))))
(vim-tab-bar-mode 1))))
(defun syd-tab-bar-new-tab ()
(interactive)
(let ((tab-bar-tab-post-open-functions
(cons (lambda (_tab)
(switch-to-buffer
(funcall syd-tab-bar-default-buffer-function)))
tab-bar-tab-post-open-functions)))
(tab-bar-new-tab)))
(syd-add-hook 'tab-bar-tab-pre-close-functions
(defun syd-tab-bar-hide-tab-bar-h (_tab _final-tab-p)
@@ -51,7 +58,7 @@ given \"explicit names\" that are static."
(interactive (list (read-string "Tab name: ")))
;; Relies on `syd-tab-bar--name-new-tab-h'.
(let ((syd-tab-bar-name-function (lambda () name)))
(tab-bar-new-tab)))
(syd-tab-bar-new-tab)))
(general-def
:prefix-map 'syd-leader-tab-map
@@ -59,7 +66,7 @@ given \"explicit names\" that are static."
"]" #'tab-next
"r" #'tab-rename
"R" #'tab-rename
"n" #'tab-new
"n" #'syd-tab-bar-new-tab
"N" #'syd-tab-bar-new-named-tab
"d" #'tab-close)
(general-def