- About The Project
- Getting Started
- Usage
- Customization
- Alternative Packages
- Contributing
- License
- Contact
- Acknowledgments
This package provides automated tab group management for Emacs, allowing you to associate commands with specific tab groups.
Heavily inspired by project-tab-groups.el, this package generalizes the concept to arbitrary commands, providing a more flexible approach to organizing your Emacs workflow.
It automatically switches to or creates tab groups when specified commands are invoked, streamlining navigation and buffer management.
This package has been implemented with simplicity in mind.
It is a very thin layer that leverages Emacs’ tab bar mode for a user-defined workflow, adding very little complexity to it.
All the heavy lifting is done by tab-bar.el
.
Please refer to the documentation to learn about tab bar related commands.
An optional “eye-candy” mode is provided for enhanced tab bar styling.
However, by default, any further tab bar related configurations are handed to the user.
Result with the example configuration provided below:
- Emacs 28.1 or later, including
tab-bar.el
andproject.el
. - optionally
nerd-icons
for build id “eye-candy” mode
(use-package auto-tab-groups
:straight (:host github :repo "MArpogaus/auto-tab-groups")
:after tab-bar project nerd-icons
:custom
;; Automatically create tabs for denote, dirvish and customize buffers
(auto-tab-groups-create-commands
'(((denote-create-note denote-menu-list-notes consult-denote-find consult-denote-grep) . "denote")
((custom-buffer-create-internal) . "customize")
((dirvish dirvish-fd) . "dirvish")))
(auto-tab-groups-close-commands
'((dirvish-quit "dirvish" :ignore-result t)
(Custom-buffer-done "customize" :ignore-result t)))
;; Customize height of tabs
(auto-tab-groups-eyecandy-tab-height 25)
;; Define tab group icons (requires nerd-icons)
(auto-tab-groups-eyecandy-icons
'(("HOME" . (:style "suc" :icon "custom-emacs"))
("dirvish" . (:style "suc" :icon "custom-folder_oct"))
("denote" . (:style "md" :icon "notebook_edit"))
("customize" . (:style "cod" :icon "settings"))
("^\\[P\\] *" . (:style "oct" :icon "repo"))
("^\\[T\\] *" . (:style "cod" :icon "remote"))))
;; Remove prefix from project groups
(auto-tab-groups-eyecandy-tab-bar-group-name-format-function
(lambda (tab-group-name)
(if (string-match "^\\[.\\] *" tab-group-name)
(substring tab-group-name (match-end 0))
tab-group-name)))
:bind
("<your-binding>" . auto-tab-groups-new-group)
:init
;; automatically assign projects to groups
(auto-tab-groups-project-mode)
;; Enable modern tabs style
(auto-tab-groups-eyecandy-mode)
;; Enable automatic tab group management based on the rules defined above
(auto-tab-groups-mode)
:hook
;; HACK: Re-nable eyecandy mode after tab-bar-mode has been disabled
(tab-bar-mode . auto-tab-groups-eyecandy-mode))
- Download
auto-tab-groups.el
,auto-tab-groups-project.el
andauto-tab-groups-eyecandy.el
. - Place them in your Emacs
load-path
. - Add the following to your init file:
(require 'auto-tab-groups) (auto-tab-groups-mode 1)
If you don’t want to enable the provided eye-candy mode for tab bar styling, you might at least want to display the tab groups, by customizing tab-bar-format
:
(setq tab-bar-format '(tab-bar-format-tabs-groups
;;... additional format functions
))
Please refer to the documentation of tab-bar-mode
for details.
auto-tab-groups
helps to implement automatic task separation, using build in tab bar groups.
A call of a elisp function defined in auto-tab-groups-create-commands
will create a new group or switch to an existing one with the given name.
A call of a elisp function defined in auto-tab-groups-close-commands
will close the corresponding group and all tabs belonging to it.
The package itself provides only a single user facing command auto-tab-groups-new-group
for the convenient creation of new groups.
It is not planed to extend its functionality any further and instead keep the code base as small and stable as possible.
All commands for managing tabs and tab groups are provided by tab-bar.el
.
You can customize the behavior of auto-tab-groups
using the following options:
Option | Type | Description |
---|---|---|
auto-tab-groups-create-commands | alist | Commands to trigger tab group creation or switching. |
auto-tab-groups-close-commands | alist | Commands to trigger tab group closure. |
auto-tab-groups-new-choice | multiple | Adjust the behavior when new tab is created. |
auto-tab-groups-initial-group-name | string | Specify the name of the initial tab group. |
auto-tab-groups-before-create-hook | hook | Hook run before tab group creation. |
auto-tab-groups-after-create-hook | hook | Hook run after tab group creation. |
auto-tab-groups-before-delete-hook | hook | Hook run before tab group deletion. |
auto-tab-groups-after-delete-hook | hook | Hook run after tab group deletion. |
auto-tab-groups-create-commands
and auto-tab-groups-close-commands
are alists where:
- CAR: command (symbol) or list of commands.
- CDR: tab group name (string) or function returning a string.
For create-commands
, the CDR can be a function that receives the command’s result.
The tab group is created if it doesn’t exist, otherwise, Emacs switches to it.
close-commands
work similarly, closing the specified tab group after the command is run.
This package provides a minor mode to integrate with project.el
, similar to project-tab-groups.el, simply enable it with:
(auto-tab-groups-project-mode)
or
(setq auto-tab-groups-project-mode 1)
This mode dos currently not offer any customization.
The auto-tab-groups-eyecandy
minor mode provides additional customization options for enhanced tab bar styling:
Option | Type | Description |
---|---|---|
auto-tab-groups-eyecandy-icons | alist | Map tab group names to icons. |
auto-tab-groups-eyecandy-tab-height | number | Tab height in pixels. |
auto-tab-groups-eyecandy-default-icon | string | Default icon for tab groups. |
auto-tab-groups-eyecandy-icons
is an alist where:
- CAR: tab group name (string) or predicate function.
- CDR: icon string.
- tabspaces, to leverage the Emacs tab bar and the Emacs built-in project.el to create buffer-isolated workspaces that also integrate with version-controlled projects.
- project-tab-groups, implements automatic management of tab groups in the context of project.el-based projects only. If you just want project isolation, use this.
- activities, which allows the user to manage frames/tabs, windows, and buffers according to their purpose.
Any Contributions are greatly appreciated!
Distributed under the GPLv3 License.
Marcel Arpogaus - [email protected] (encrypted with [ROT13](https://rot13.com/))
Project Link: https://github.com/MArpogaus/auto-tab-groups
- Special thanks to Fritz Grabo for the inspiration and the excellent project-tab-groups package.