From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.devel Subject: Re: tab-bar-mode new tab hook? Date: Tue, 26 Apr 2022 05:48:07 -0400 Message-ID: References: <86czh5jjj4.fsf@mail.linkov.net> <86o80oz4mg.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3015"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs developers To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 26 12:16:16 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njIEx-0000Xc-OR for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Apr 2022 12:16:15 +0200 Original-Received: from localhost ([::1]:34970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njIEw-0008Rt-8u for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Apr 2022 06:16:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njHny-0000nX-Fw for emacs-devel@gnu.org; Tue, 26 Apr 2022 05:48:22 -0400 Original-Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:47098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njHnw-0000d6-O5 for emacs-devel@gnu.org; Tue, 26 Apr 2022 05:48:22 -0400 Original-Received: by mail-pf1-x431.google.com with SMTP id j6so15163929pfe.13 for ; Tue, 26 Apr 2022 02:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TQkQeSqr9J4qfKckl35z9y1jy2kgsYiRoOVrhOP+21c=; b=aWbBmoNQ5LFaCC6p10e3s7pkkyNxQLCPzyXl+QtxsJcug76UbcP7I5nm4zVn1dGcxs 2i7gvgH2ULw6GBa4lEy3i6W1rTwLiRXpgYwV55RkjMojRJDsZA1WdsbgJ7xyM3um6to7 vUVev/LXTsG0rBeUAUsHKmRnlb2bGwD+kn2VOMNhg8JuSnku6ACuqYgZsEYNPk21SXwg UWrHbpJXYMj8w7/s69GCSdgThpgEpPafCA4OA0zHCH8cfIqJeo7l+nUE5TSEAih3IJqD TiidsB2NEmO/qgr1gVyPmHj0VjiLTD2NGweDaoQjlVjUscPVK6NUfK5XSFIB7aDbD0Y3 l/wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TQkQeSqr9J4qfKckl35z9y1jy2kgsYiRoOVrhOP+21c=; b=rCWKJBd//aP2kOZcsjEy3NEhIimIvciyU6CAOSa/Y5bTMTdQpTuDy4G+CCGuLhfAnU oliachu+Jr0ftqZmkGPamWSbVqRZYhN9ZDs4NRsvYOfRIyygFOZX93s+hoFMQECl/WhS BuEv3r1S5w/dgojdFRbcg3TmSCe3EfdODew4SdhD8fAKK4VLkJB9BllokIxEKpnB4VVi QAAb7qrx9CqtSj1eRGZF1pYStASo770y5v/CuAJXi3aq+EHiPaNGV3TKLS7OcKf5sw7c uhXtFD+tmWcU+FdYgKof6Ut/5FpJ5he/8TGKc3RbUa2Et461OhZk4t13DBV2EZ45rijj 5c4g== X-Gm-Message-State: AOAM530HGz49Wl/cs0KnUnae5A93dYg4Lte6heN8cyVIMslMEcV+6sPD 0obXKZ+etkYopuCobFZbbQdy+hG6r6Lwo9RBhSV3PhchSoY= X-Google-Smtp-Source: ABdhPJxhdHfvUMGqESXJX6dQp+584Cr7z6tJMgDQmysP2e61RvlBfe1xSNgVmmcQ/2Mp08xJcwLSFYuC7L/Kyl03h8w= X-Received: by 2002:a63:cd0d:0:b0:39c:d48c:67cc with SMTP id i13-20020a63cd0d000000b0039cd48c67ccmr19049837pgg.606.1650966499100; Tue, 26 Apr 2022 02:48:19 -0700 (PDT) In-Reply-To: <86o80oz4mg.fsf@mail.linkov.net> Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=aaronjensen@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:288885 Archived-At: On Tue, Apr 26, 2022 at 3:29 AM Juri Linkov wrote: > > 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. Ok, thank you. It does seem like I can use `tab-bar-new-tab-choice' to set the buffer list, but it only works in a subset of situations. Any command that sets it like `tab-bar-move-tab-to-window' would not be able to use it. > >> > 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. I (and others I have seen) are using tabs as a way to replace persp-mode/perspective.el, i.e. workspaces. I know some in other text editors that use our equivalent of frames for this purpose. The intent is that each workspace is relatively isolated from one another. Each has its own window configuration and I think it's natural for each workspace to have its own buffer list. I think that project.el works great when there is a direct 1:1 mapping between a project and its workspace. I even use a combination of project.el and tabs (new tab from known project, for example). From there, `project-find-file' is useful for finding files in the project that would then get added to the buffer list. It's just every once in a while that I may want a custom scratch buffer or to pull a file in that is outside of a project to be in the current project's workspace, but it does happen. And when it does happen, I want the buffer list to be separate from the project specific buffer list. I want a "workspace buffer list". A project is a physical and "permanent" workspace but I am using tabs as a logical and transient workspace, which often (but not always) maps 1:1 with a project. I looked at filesets and filecache and I don't think they would work here without hooking into all of the buffer management machinery. 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. > 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. I just found `tab-bar-tab-post-open-functions', which should do exactly what I need. Thanks, Aaron