Make disabling centaur-tabs resilient to the mode being off

This commit is contained in:
Jeremy Dormitzer 2020-02-15 07:38:45 -05:00
parent a72565a0b4
commit 5ed91f08eb

View File

@ -2130,7 +2130,9 @@ UI-related keybindings:
[[https://github.com/ema2159/centaur-tabs][Centaur tabs]] is a package that gives Emacs buffer tabs similar to those in Atom or VS Code:
#+BEGIN_SRC emacs-lisp
(use-package centaur-tabs
:commands (centaur-tabs-mode)
:commands (centaur-tabs-mode
centaur-tabs-local-mode
centaur-tabs-mode-on-p)
:init
(setq centaur-tabs-set-icons t
centaur-tabs-gray-out-icons 'buffer
@ -2145,6 +2147,11 @@ UI-related keybindings:
centaur-tabs-close-button "✕"
centaur-tabs-modified-marker "⬤")
(leader-def-key "uT" #'centaur-tabs-mode)
(defun disable-centaur-tabs ()
"Disables centaur-tabs in current buffer"
(interactive)
(when (centaur-tabs-mode-on-p)
(centaur-tabs-local-mode)))
(centaur-tabs-mode)
:config
(centaur-tabs-group-by-projectile-project)
@ -2152,14 +2159,14 @@ UI-related keybindings:
((normal motion visual) "g t" #'centaur-tabs-forward)
((normal motion visual) "g T" #'centaur-tabs-backward)
:hook
(imenu-list-major-mode . centaur-tabs-local-mode)
(dashboard-mode . centaur-tabs-local-mode)
(git-commit-mode . centaur-tabs-local-mode)
(eshell-mode . centaur-tabs-local-mode)
(vterm-mode . centaur-tabs-local-mode)
(shell-mode . centaur-tabs-local-mode)
(term-mode . centaur-tabs-local-mode)
(inferior-python-mode . centaur-tabs-local-mode))
(imenu-list-major-mode . disable-centaur-tabs)
(dashboard-mode . disable-centaur-tabs)
(git-commit-mode . disable-centaur-tabs)
(eshell-mode . disable-centaur-tabs)
(vterm-mode . disable-centaur-tabs)
(shell-mode . disable-centaur-tabs)
(term-mode . disable-centaur-tabs)
(inferior-python-mode . disable-centaur-tabs))
#+END_SRC
* Frame parameters