From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Cochran Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Enable persistent naming for tabs Date: Wed, 30 Oct 2019 11:35:37 -0700 Message-ID: <8736faozd2.fsf@cochranmail.com> References: <87r23lpg22.fsf@cochranmail.com> <871rvktgyj.fsf@mail.linkov.net> <87ftjz6v4d.fsf@cochranmail.com> <87lftoiwfl.fsf@mail.linkov.net> <87eez7la3v.fsf@mail.linkov.net> <878spddbpj.fsf@mail.linkov.net> <87eez3xwi1.fsf@cochranmail.com> <87ftjjfb4h.fsf@mail.linkov.net> <87r230akt8.fsf@cochranmail.com> <87wocruqmb.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="144413"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, "T.V Raman" To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 30 21:48:28 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iPutH-000bU0-Of for ged-emacs-devel@m.gmane.org; Wed, 30 Oct 2019 21:48:27 +0100 Original-Received: from localhost ([::1]:44212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPutG-00066S-7v for ged-emacs-devel@m.gmane.org; Wed, 30 Oct 2019 16:48:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52853) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPsp0-0003TD-05 for emacs-devel@gnu.org; Wed, 30 Oct 2019 14:35:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPsoy-0007Lb-Ad for emacs-devel@gnu.org; Wed, 30 Oct 2019 14:35:53 -0400 Original-Received: from mail.cochranmail.com ([64.140.150.170]:56682) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPsox-0007G6-Ns for emacs-devel@gnu.org; Wed, 30 Oct 2019 14:35:52 -0400 Original-Received: from SoraLaptop (174-21-68-83.tukw.qwest.net [174.21.68.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.cochranmail.com (Postfix) with ESMTPSA id 828EC7AF; Wed, 30 Oct 2019 11:35:45 -0700 (PDT) In-Reply-To: <87wocruqmb.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 27 Oct 2019 00:46:36 +0300") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.140.150.170 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241645 Archived-At: Juri Linkov writes: >> It occurred to me in the process of writing this up that it might be >> useful to provide hook variables for creating and closing tabs - >> 'tab-bar-tab-open-hook' and 'tab-bar-tab-close-hook' perhaps? Standard >> fare on those - a list of functions that take the tab as an argument, >> probably called as the last task of tab creation and the first task of >> tab closing? Thoughts? > > Not sure if this could be a hook on tab-bar basic events, > or a customizable function. Also not clear whether to call it > before or after the main body. > > We need to collect more examples of use cases to decide > on the implementation. I believe it better to be a hook personally, though admittedly that kind of depends on how exactly you want to use the functionality. A hook allows for several interested parties to be able to act on a tab create/close instead of just one. This allows better for dynamically adding or removing situationally dependent behavior. For example, maybe I want to kill some/all of the buffers in the tab when I close it, but only under certain circumstances, like if it's a tab containing non-file 'work' buffers like those of Magit or mpd. Another is if I open a new tab, and I want to be prompted to name the tab automatically depending on the buffers that exist at the time of creation - I have a tendency to segregate all of my Magit buffers for a repository into a single tab, and I usually rename the tab so that no matter what Magit sub-buffer I'm on, the tab still has a consistent name. I can see myself doing similar for other 'task-oriented' sets of windows and buffers such as gdb, mpd, etc. Either way, I suggest that we call any type of user-defined function on tab creation at the end of the function body, and any type of user-defined function on tab deletion at the beginning of the function body. IMO there's nothing reasonable to do on tab creation until after most of the work has been done already anyways, and that it's too late to do anything on tab close except at the very beginning, when it's still an open tab. Thanks, -- ~Robert Cochran