unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: tab-bar-mode new tab hook?
Date: Tue, 26 Apr 2022 11:56:49 -0400	[thread overview]
Message-ID: <CAHyO48yDdXMBXoFbTGtczqOd1EqvnPb3E8ShRRxuB75erMmhDQ@mail.gmail.com> (raw)
In-Reply-To: <864k2fyjr3.fsf@mail.linkov.net>

On Tue, Apr 26, 2022 at 11:53 AM Juri Linkov <juri@linkov.net> wrote:
>
> > I imagine you didn't intend for it, but the fact that tab-bar-mode
> > manages its own buffer-list frame-parameter per tab makes it perfectly
> > suited for the purpose of tabs being used as workspaces.
>
> The intention was to make tabs as a light-weigh version of frames,
> so like every frame uses own frame-local buffer-list, switching tabs
> updates frame buffer-list to maintain a tab as a separate frame.
>
> > I just found `tab-bar-tab-post-open-functions', which should do
> > exactly what I need.
>
> I still don't understand why you need to run a hook only on opening
> a new tab, and not on switching tabs, to update frame parameters,
> but glad to hear that the existing hook does what you need.

Because the only thing I need is to set the initial buffer list and
then what you described above takes care of switching tabs. This is
what we are doing:

(set-frame-parameter nil
                     'buffer-list
                     (let ((window-buffers (mapcar #'window-buffer
(window-list))))
                       (seq-filter (lambda (buffer)
                                     (or (member buffer window-buffers)
                                         (member (buffer-name buffer)
                                                 tabspaces-include-buffers)))
                                   (frame-parameter nil 'buffer-list))))
(set-frame-parameter nil
                     'buried-buffer-list
                     (seq-filter (lambda (buffer)
                                   (member (buffer-name buffer)
                                           tabspaces-include-buffers))
                                 (frame-parameter nil 'buried-buffer-list)))

tab-bar-mode takes care of the rest by doing what you describe above.



      reply	other threads:[~2022-04-26 15:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25  2:07 tab-bar-mode new tab hook? Aaron Jensen
2022-04-25 15:44 ` Juri Linkov
2022-04-26  3:27   ` Aaron Jensen
2022-04-26  7:27     ` Juri Linkov
2022-04-26  9:48       ` Aaron Jensen
2022-04-26 15:48         ` Juri Linkov
2022-04-26 15:56           ` Aaron Jensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHyO48yDdXMBXoFbTGtczqOd1EqvnPb3E8ShRRxuB75erMmhDQ@mail.gmail.com \
    --to=aaronjensen@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).