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: [[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 #+BEGIN_SRC emacs-lisp
(use-package centaur-tabs (use-package centaur-tabs
:commands (centaur-tabs-mode) :commands (centaur-tabs-mode
centaur-tabs-local-mode
centaur-tabs-mode-on-p)
:init :init
(setq centaur-tabs-set-icons t (setq centaur-tabs-set-icons t
centaur-tabs-gray-out-icons 'buffer centaur-tabs-gray-out-icons 'buffer
@ -2145,6 +2147,11 @@ UI-related keybindings:
centaur-tabs-close-button "✕" centaur-tabs-close-button "✕"
centaur-tabs-modified-marker "⬤") centaur-tabs-modified-marker "⬤")
(leader-def-key "uT" #'centaur-tabs-mode) (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) (centaur-tabs-mode)
:config :config
(centaur-tabs-group-by-projectile-project) (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-forward)
((normal motion visual) "g T" #'centaur-tabs-backward) ((normal motion visual) "g T" #'centaur-tabs-backward)
:hook :hook
(imenu-list-major-mode . centaur-tabs-local-mode) (imenu-list-major-mode . disable-centaur-tabs)
(dashboard-mode . centaur-tabs-local-mode) (dashboard-mode . disable-centaur-tabs)
(git-commit-mode . centaur-tabs-local-mode) (git-commit-mode . disable-centaur-tabs)
(eshell-mode . centaur-tabs-local-mode) (eshell-mode . disable-centaur-tabs)
(vterm-mode . centaur-tabs-local-mode) (vterm-mode . disable-centaur-tabs)
(shell-mode . centaur-tabs-local-mode) (shell-mode . disable-centaur-tabs)
(term-mode . centaur-tabs-local-mode) (term-mode . disable-centaur-tabs)
(inferior-python-mode . centaur-tabs-local-mode)) (inferior-python-mode . disable-centaur-tabs))
#+END_SRC #+END_SRC
* Frame parameters * Frame parameters