[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tab-bar-mode new tab hook?
From: |
Juri Linkov |
Subject: |
Re: tab-bar-mode new tab hook? |
Date: |
Mon, 25 Apr 2022 18:44:43 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
> I've been experimenting using tabspaces
> (https://github.com/mclear-tools/tabspaces) to enable each tab to have
> its own isolated buffer list. It provides a command,
> tabspaces-create-workspace that invokes tab-bar-new-tab and then sets
> frame parameters to isolate the buffer list space.
>
> I was curious if there has been any thought given to including a hook
> for when a new tab is created. This way, I could just add a hook to do
> this and not have to use a separate command (and replace all the other
> commands that use tab-bar-new-tab). I could use advice, but that seems
> like a last resort.
You can provide own custom function for tab-bar-new-tab-choice.
Then you can set an initial buffer list in it, and even to display
this buffer list as the default contents of the new tab.
> Alternatively (or in addition) is the behavior to isolate buffer lists
> in tabs one that would make sense for Emacs to support out-of-the-box?
There is already project-based buffer isolation that works nicely
with tabs, so in a new tab you can set a tab group name, and just
use project buffer commands: 'C-x p b' (project-switch-to-buffer),
'C-x p k' (project-kill-buffers), etc. Switching to a project buffer
in a new tab is also supported with 'C-x t p b'.