diff --git a/Eask b/Eask index 0762307..8010d1c 100644 --- a/Eask +++ b/Eask @@ -1,5 +1,5 @@ (package "centaur-tabs" - "5" + "3.3" "Aesthetic, modern looking customizable tabs plugin") (website-url "https://github.com/ema2159/centaur-tabs") @@ -12,8 +12,7 @@ (source 'gnu) (source 'melpa) -(depends-on "emacs" "24.4") +(depends-on "emacs" "26.1") (depends-on "powerline") -(depends-on "cl-lib") (setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 diff --git a/centaur-tabs-elements.el b/centaur-tabs-elements.el index af9ef85..3a30aad 100644 --- a/centaur-tabs-elements.el +++ b/centaur-tabs-elements.el @@ -27,6 +27,7 @@ ;;; Code: +(require 'custom) (require 'color) (require 'powerline) @@ -40,14 +41,12 @@ ;;; Faces (defface centaur-tabs-default - '((t - (:background "black" :foreground "black"))) + '((t (:background "black" :foreground "black"))) "Default face used in the tab bar." :group 'centaur-tabs) (defface centaur-tabs-unselected - '((t - (:background "#3D3C3D" :foreground "grey50"))) + '((t (:background "#3D3C3D" :foreground "grey50"))) "Face used for unselected tabs." :group 'centaur-tabs) @@ -57,8 +56,7 @@ :group 'centaur-tabs) (defface centaur-tabs-unselected-modified - '((t - (:background "#3D3C3D" :foreground "grey50"))) + '((t (:background "#3D3C3D" :foreground "grey50"))) "Face used for unselected-modified tabs." :group 'centaur-tabs) @@ -68,8 +66,7 @@ :group 'centaur-tabs) (defface centaur-tabs-close-unselected - '((t - (:inherit centaur-tabs-unselected))) + '((t (:inherit centaur-tabs-unselected))) "Face used for unselected close button." :group 'centaur-tabs) @@ -877,12 +874,15 @@ Create one if the frame doesn't have one yet." (defun centaur-tabs-select-separator-style (tab-style) "Set the separator style to TAB-STYLE." - (setq centaur-tabs-style-left - (funcall (intern (format "powerline-%s-right" tab-style)) - 'centaur-tabs-default nil centaur-tabs-height)) - (setq centaur-tabs-style-right - (funcall (intern (format "powerline-%s-left" tab-style)) nil - 'centaur-tabs-default centaur-tabs-height))) + (let* ((theme (or (car custom-enabled-themes) "default")) + (name (intern (format "centaur-tabs--%s-face" theme))) + (face (copy-face 'centaur-tabs-default name))) + (setq centaur-tabs-style-left + (funcall (intern (format "powerline-%s-right" tab-style)) + face nil centaur-tabs-height)) + (setq centaur-tabs-style-right + (funcall (intern (format "powerline-%s-left" tab-style)) + nil face centaur-tabs-height)))) (provide 'centaur-tabs-elements) ;;; centaur-tabs-elements.el ends here diff --git a/centaur-tabs-functions.el b/centaur-tabs-functions.el index 69452ae..a5a9031 100644 --- a/centaur-tabs-functions.el +++ b/centaur-tabs-functions.el @@ -40,6 +40,8 @@ (defvar centaur-tabs--buffer-show-groups) (defvar centaur-tabs-ace-jump-active) +(declare-function centaur-tabs-mode "centaur-tabs.el") + ;; ;;; Customs @@ -557,6 +559,18 @@ hooked functions" (centaur-tabs-set-template centaur-tabs-current-tabset nil) (centaur-tabs-display-update)) +(defun centaur-tabs-re-enable () + "Re-enable `centaur-tabs-mode'." + (centaur-tabs-mode -1) + (centaur-tabs-mode 1)) + +(defun centaur-tabs--after-load-theme (&rest _) + "Function to be run after the theme changed." + (setq centaur-tabs-style-right nil + centaur-tabs-style-left nil) + ;; XXX: Dirty hack, is there a way to improve this? + (centaur-tabs-re-enable)) + ;; ;;; Events and event functions diff --git a/centaur-tabs.el b/centaur-tabs.el index e8e8478..a77317d 100644 --- a/centaur-tabs.el +++ b/centaur-tabs.el @@ -11,7 +11,7 @@ ;; Created: 2019-21-19 22:14:34 ;; Version: 3.3 ;; Known Compatibility: GNU Emacs 26.2 -;; Package-Requires: ((emacs "26.1") (powerline "2.4") (cl-lib "0.5")) +;; Package-Requires: ((emacs "26.1") (powerline "2.4")) ;; Keywords: frames ;;; This file is NOT part of GNU Emacs @@ -202,7 +202,8 @@ Run as `centaur-tabs-init-hook'." (add-hook 'kill-buffer-hook #'centaur-tabs-buffer-track-killed) (advice-add #'undo :after #'centaur-tabs-after-modifying-buffer) (advice-add #'undo-tree-undo-1 :after #'centaur-tabs-after-modifying-buffer) - (advice-add #'undo-tree-redo-1 :after #'centaur-tabs-after-modifying-buffer)) + (advice-add #'undo-tree-redo-1 :after #'centaur-tabs-after-modifying-buffer) + (advice-add 'load-theme :after #'centaur-tabs--after-load-theme)) (defun centaur-tabs-buffer-quit () "Quit tab bar buffer. @@ -217,7 +218,8 @@ Run as `centaur-tabs-quit-hook'." (remove-hook 'kill-buffer-hook 'centaur-tabs-buffer-track-killed) (advice-remove #'undo #'centaur-tabs-after-modifying-buffer) (advice-remove #'undo-tree-undo-1 #'centaur-tabs-after-modifying-buffer) - (advice-remove #'undo-tree-redo-1 #'centaur-tabs-after-modifying-buffer)) + (advice-remove #'undo-tree-redo-1 #'centaur-tabs-after-modifying-buffer) + (advice-remove 'load-theme #'centaur-tabs--after-load-theme)) (add-hook 'centaur-tabs-init-hook #'centaur-tabs-buffer-init) (add-hook 'centaur-tabs-quit-hook #'centaur-tabs-buffer-quit)