diff --git a/emacs/init.org b/emacs/init.org index 0552fcd..be22486 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -2306,6 +2306,31 @@ UI-related keybindings: :config (centaur-tabs-group-by-projectile-project) + ;; Custom buffer groups + (defun centaur-tabs-projectile-buffer-groups () + "Return the list of group names BUFFER belongs to." + (if centaur-tabs-projectile-buffer-group-calc + (symbol-value 'centaur-tabs-projectile-buffer-group-calc) + (set (make-local-variable 'centaur-tabs-projectile-buffer-group-calc) + + (cond + ((or (get-buffer-process (current-buffer)) (memq major-mode '(comint-mode compilation-mode))) '("Term")) + ((string-equal "*" (substring (buffer-name) 0 1)) '("Misc")) + ((condition-case _err + (projectile-project-root) + (error nil)) (list (projectile-project-name))) + ((memq major-mode '(emacs-lisp-mode python-mode emacs-lisp-mode c-mode + c++-mode javascript-mode js-mode + js2-mode makefile-mode + lua-mode vala-mode)) '("Coding")) + ((memq major-mode '(nxhtml-mode html-mode + mhtml-mode css-mode)) '("HTML")) + ((memq major-mode '(org-journal-mode)) '("Journal")) + ((memq major-mode '(org-mode calendar-mode diary-mode)) '("Org")) + ((memq major-mode '(dired-mode)) '("Dir")) + (t '("Other")))) + (symbol-value 'centaur-tabs-projectile-buffer-group-calc))) + ;; Only show tabs in buffers visiting files (advice-add 'centaur-tabs-line :around (lambda (oldfn &rest args)