emacs-devel
[Top][All Lists]
Advanced

[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: Tue, 26 Apr 2022 10:27:19 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> 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.
>
> This function seems like it is meant to just return the buffer to
> display in the new tab. It also seem like it is called before the new
> tab is actually created. I haven't tried it yet, but I would think
> that would mean that any modification of frame parameters in that

tab-bar-new-tab-choice prepares the window configuration for the new tab,
so it's a suitable place to modify frame parameters, e.g.

  (setq tab-bar-new-tab-choice
        (lambda ()
          (set-frame-parameter nil 'name "tab-2")
          (current-buffer)))

> function would apply to the previous tab, rather than the about to be
> created tab.

This detail is relevant only when you want to modify tab parameters.
And tab parameters already include frame buffer-list and buried-buffer-list.
So not only after creating a new tab, but also after switching between tabs
these frame parameters get updated.

>> > 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'.
>
> Yes, I used that before, but I like to be able to bring buffers in
> from other projects and have them in my buffer list. Sort of reference
> files from one project to another, so it is nice for them to actually
> have their own buffer lists entirely that is not limited to those in
> the project.

Don't you think that a feature of limiting a list of buffers
has only distant connection to tabs?  Isn't it the purpose
of project.el to define a list of buffers?  So maybe it would be
easier to add a new backend to project.el with a list of predefined
files/buffers?  There are also other packages that do something
like this such as lisp/filesets.el and lisp/filecache.el.

But if you want to plug such a feature into tabs, we could add
more hooks to tab-bar-mode to make it easier to do this.
So please help to identify these points for more customization.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]