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