From 5ed91f08ebfb45d9729bc0422b34c2fad11fcc7d Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 15 Feb 2020 07:38:45 -0500 Subject: [PATCH] Make disabling centaur-tabs resilient to the mode being off --- emacs/init.org | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index f6a6bfc..30e43d9 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -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