reddit / emacs

Moveable tabs + workgroup setup?

matsumonkie · 2022-02-12 20:50
Basically, similar question to [https://www.reddit.com/r/emacs/comments/it9vw3/centaurtabs\_and\_perspmode/](https://www.reddit.com/r/emacs/comments/it9vw3/centaurtabs_and_perspmode/) I just want to be able to have tabs that I can reorganize amongst themselves (I couldn't figure out how to do that with native emacs tabs), and workgroups (e.g: perspective/workgroups/persp-mode/...) to be able to switch from a set of tabs to another set of tabs. Currently I have centaur-tabs setup because it's the only tab solution that allows me to move tabs (eg: centaur-tabs-move-current-tab-to-left, centaur-tabs-move-current-tab-to-right), but it doesn't play nice with any workgroup packages. Tabs stay visible in all workgroups with perspective Has anyone been able to achieve this?
fritzgrabo · 2022-02-13 21:27
I might be wrong, but it sounds like you're on Emacs 27. If you can, check out Emacs 28 (or newer). In addition to the existing `tab-bar-move-tab` (move tab right), it also provides a bindable `tab-bar-move-tab-backward` command to move a tab left. Emacs 28 also introduces the concept of "tab groups" and a way to keep all tabs but those of the currently active group hidden (see `tab-bar-format`, and specifically its `tab-bar-format-tabs-groups` option). It'll still show the names of the other, inactive tab groups, but at least it doesn't show all their contained tabs. You might be able to hide inactive groups altogether using face properties. Regarding the integration with workgroup packages and jumping between groups of tabs: I had a similar issue regarding the integration of the tab bar and Emacs' `project.el` package (a project could be considered a workgroup I guess), so I wrote the [project-tab-groups](https://github.com/fritzgrabo/project-tab-groups) package to help with that. The elisp is rather simple, you might be able to take inspiration from it and rework it for use with workgroups/perspective/etc. In case you can't upgrade to Emacs 28, you might want to check out the [tab-bar-lost-commands](https://github.com/fritzgrabo/tab-bar-lost-commands) package to help with bindable commands for moving tabs forward and backward (and some other goodies). Finally, I'm not sure I got what you mean by "reorganise tabs by themselves" exactly, but you might want to check out the [tab-bar-groups](https://github.com/fritzgrabo/tab-bar-groups) package, which -- among other things -- provides a `tab-bar-groups-regroup-tabs` command. If you add to Emacs own `tab-bar-tab-post-change-group-functions`, you could use it to force all tabs of one group to be next to each other at all times.
matsumonkie · 2022-02-15 19:56
Thank you for your answer. tab-bar-mode is interesting to use as an environment workspace and I'd use it but I need on top of it to be able to use regular tabs (e.g: list of buffers). Unfortunately, the built-in tab-line mode doesn't allow to shift a tab to its right/left. note: I'm running emacs28
matsumonkie · 2022-02-15 20:03
Actually, it seems the combination centaur-tabs + tab-bar works. It needs some tweaking but overall it seems to do the job \\o/
fritzgrabo · 2022-02-15 22:42
Ooh, I see now. I read "tabs" in your original post and immediately thought "tab *bar*", while you were talking about the "tab *line*" rather. Well, that changes everything, haha. I'm glad to hear you found a combination that works for you. Using the tab bar to manage workspaces seems like a good fit, I agree!
matsumonkie · 2022-02-16 08:37
Yes, it seems to work so far. Thanks for the suggestion!!