ema2159 / centaur-tabs

Emacs plugin aiming to become an aesthetic, modern looking tabs plugin
GNU General Public License v3.0
757 stars 51 forks source link

Icons doesn't work #246

Open georgtree opened 3 weeks ago

georgtree commented 3 weeks ago

Hello! Icons doesn't work, all-the-icons is installed and works in treemacs, configs:

(use-package all-the-icons
  :ensure t
  :if (display-graphic-p))

and

(use-package centaur-tabs
  :ensure t
  :demand
  :config
  (centaur-tabs-mode t)
  (centaur-tabs-headline-match)
  (setq centaur-tabs-style "bar"
        centaur-tabs-height 32
        centaur-tabs-set-icons t
        centaur-tabs-show-new-tab-button t
        centaur-tabs-set-modified-marker t
        centaur-tabs-show-navigation-buttons t
        centaur-tabs-set-bar 'under
    centaur-tabs-plain-icons t
        centaur-tabs-show-count nil)
  (centaur-tabs-change-fonts "Fira Code" 110)
  (centaur-tabs-group-by-projectile-project)
  (defun centaur-tabs-buffer-groups ()
    "`centaur-tabs-buffer-groups' control buffers' group rules.

Group centaur-tabs with mode if buffer is derived from `eshell-mode' `emacs-lisp-mode' `dired-mode' `org-mode' `magit-mode'.
All buffer name start with * will group to \"Emacs\".
Other buffer group by `centaur-tabs-get-group-name' with project name."
    (list
     (cond
      ;; ((not (eq (file-remote-p (buffer-file-name)) nil))
      ;; "Remote")
      ((or (string-equal "*" (substring (buffer-name) 0 1))
           (memq major-mode '(magit-process-mode
                              magit-status-mode
                              magit-diff-mode
                              magit-log-mode
                              magit-file-mode
                              magit-blob-mode
                              magit-blame-mode
                              )))
       "Emacs")
      ((derived-mode-p 'prog-mode)
       "Editing")
      ((derived-mode-p 'dired-mode)
       "Dired")
      ((memq major-mode '(helpful-mode
                          help-mode))
       "Help")
      ((memq major-mode '(org-mode
                          org-agenda-clockreport-mode
                          org-src-mode
                          org-agenda-mode
                          org-beamer-mode
                          org-indent-mode
                          org-bullets-mode
                          org-cdlatex-mode
                          org-agenda-log-mode
                          diary-mode))
       "OrgMode")
      (t
       (centaur-tabs-get-group-name (current-buffer))))))
  :bind
  ("C-<prior>" . centaur-tabs-backward)
  ("C-<next>" . centaur-tabs-forward))`

Linux Ubuntu

snoopier commented 2 weeks ago

Same issue. On my side with an existing init.

I found out that the

(defcustom centaur-tabs-icon-type (and centaur-tabs-set-icons (or (require 'all-the-icons nil t) (require 'nerd-icons nil t))) "Icon type; it should be one of all-the-icons' andnerd-icons'." :group 'centaur-tabs :type 'symbol :set (lambda (k v) (pcase v ('all-the-icons (unless (require 'all-the-icons nil t) (setq v nil))) ('nerd-icons (unless (require 'nerd-icons nil t) (setq v nil))) ('type (if (require 'all-the-icons nil t) (setq v 'all-the-icons) (setq v nil)))) (set k v)))

returns "nil" although (require 'all-the-icons nil t) return 'all-the-icons

if i overwrite the variable with (customize-set-variable 'centaur-tabs-icon-type 'all-the-icons) the icons appear.

Unfortunatly my elisp skill is to low to see the issue here :-( Till a fix will come i use the overwrite as workaround

thx and BR Dennis

snoopier commented 2 weeks ago

(defcustom centaur-tabs-icon-type (cond ((and centaur-tabs-set-icons (require 'all-the-icons nil t)) 'all-the-icons) ((and centaur-tabs-set-icons (require 'nerd-icons nil t)) 'nerd-icons) (t nil)) "Icon type; it should be one of all-the-icons' ornerd-icons'." :group 'centaur-tabs :type 'symbol :set (lambda (k v) (set k (pcase v ('all-the-icons (if (require 'all-the-icons nil t) 'all-the-icons nil)) ('nerd-icons (if (require 'nerd-icons nil t) 'nerd-icons nil)) (_ nil)))))

jcs090218 commented 2 weeks ago

Make sure centaur-tabs-icon-type is set to a valid value. 🤔

snoopier commented 2 weeks ago

Yes if i customize the ' centaur-tabs-icon-type' then it works, but that way is not described in the documentation and from my point of view it's not the intention of the developer. This variable has an autodetection of 'all-the-icons' and this doesn't work proper. Maybe there is a race condition or what ever... By the way the pcase function has no default value.

jcs090218 commented 2 weeks ago

Documented in 46fdeb359dbbcbb1bd2ddce3c1e6fa694bf8e68f.