ema2159 / centaur-tabs

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

Support `project.el` #209

Open swarnendubiswas opened 1 year ago

swarnendubiswas commented 1 year ago

Does centaur-tabs support project.el instead of projectile? The project buffers are not aligned in the same tabs view when using project.el. I can reproduce the problem with Emacs 28.2 with the following MWE and emacs -nw -q.

(setq straight-build-dir (format "build/%d%s%d"
                                 emacs-major-version
                                 version-separator
                                 emacs-minor-version)
      straight-use-package-by-default t)

(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq use-package-hook-name-suffix nil)
(straight-use-package 'use-package)

(use-package project
  :bind-keymap ("C-c p" . project-prefix-map)
  :bind
  (("<f5>" . project-switch-project)
    ("<f6>" . project-find-file)))

(use-package centaur-tabs
  :hook (emacs-startup-hook . centaur-tabs-mode)
  :bind*
  (("M-<right>" . centaur-tabs-forward-tab)
    ("M-<left>" . centaur-tabs-backward-tab)
    ("M-\"" . centaur-tabs-ace-jump))
  :custom
  (centaur-tabs-set-modified-marker t)
  (centaur-tabs-modified-marker "•") ; Unicode Bullet (0x2022)
  (centaur-tabs-set-close-button nil "I do not use the mouse")
  (centaur-tabs-show-new-tab-button nil "I do not use the mouse")
  (centaur-tabs-enable-ido-completion nil)
  ;; Other styles like "wave" are not rendered on the terminal, and also does not work well with
  ;; many themes
  (centaur-tabs-style "bar")
  (centaur-tabs-set-bar 'under)
  (centaur-tabs-height 18)
  (centaur-tabs-set-icons nil)
  (centaur-tabs-icon-type 'nerd-icons)
  (centaur-tabs-gray-out-icons t "Gray out icons for inactive tabs"))
grolongo commented 1 year ago

It does, as I have it working without any specific project.el configuration. I'm using Emacs 29 though.
I suggest you either compile Emacs yourself or use a pretest release of Emacs 29 to make sure.
You could also just wait for the next stable Emacs release which should happen in a few days now.

swarnendubiswas commented 1 year ago

No, project.el is not playing nicely with centaur-tabs even on Emacs 29 RC2 for me.

grolongo commented 1 year ago

you need to define centaur-tabs-buffer-groups with (t (centaur-tabs-get-group-name (current-buffer) under :config in your use-package declaration, example:

(defun centaur-tabs-buffer-groups ()
  "Centaur grouping."
  (list (cond ((derived-mode-p 'erc-mode) "ERC")
              (t (centaur-tabs-get-group-name (current-buffer))))))
swarnendubiswas commented 1 year ago

@grolongo Your suggested snippet does not work for me.