From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] tab-bar.el: add defcustoms for functions to call after opening and before closing Date: Sun, 08 Dec 2019 00:25:03 +0200 Organization: LINKOV.NET Message-ID: <87muc3ixj4.fsf@mail.linkov.net> References: <87h83egmzy.fsf@cochranmail.com> <87r22fzhag.fsf@mail.linkov.net> <87zhgawdk9.fsf@cochranmail.com> <87o8wpm15x.fsf@mail.linkov.net> <87immvzvf8.fsf@cochranmail.com> <87lfrrn20p.fsf@mail.linkov.net> <8736dyfk63.fsf@cochranmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="149984"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: Robert Cochran , emacs-devel@gnu.org To: Robert Cochran Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 07 23:39:10 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 1idijF-000ctD-Sd for ged-emacs-devel@m.gmane.org; Sat, 07 Dec 2019 23:39:10 +0100 Original-Received: from localhost ([::1]:53800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idijE-0004cW-Nj for ged-emacs-devel@m.gmane.org; Sat, 07 Dec 2019 17:39:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48120) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idij6-0004cJ-SP for emacs-devel@gnu.org; Sat, 07 Dec 2019 17:39:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idij5-00017c-N6 for emacs-devel@gnu.org; Sat, 07 Dec 2019 17:39:00 -0500 Original-Received: from aye.elm.relay.mailchannels.net ([23.83.212.6]:2646) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1idij5-0000q5-4H for emacs-devel@gnu.org; Sat, 07 Dec 2019 17:38:59 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 77FB35E150B; Sat, 7 Dec 2019 22:38:56 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a51.g.dreamhost.com (100-96-8-88.trex.outbound.svc.cluster.local [100.96.8.88]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 00CBF5E14E0; Sat, 7 Dec 2019 22:38:55 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a51.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Sat, 07 Dec 2019 22:38:56 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Continue-Decisive: 2d93e6905ad73ea8_1575758336221_3578097487 X-MC-Loop-Signature: 1575758336220:777003600 X-MC-Ingress-Time: 1575758336220 Original-Received: from pdx1-sub0-mail-a51.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a51.g.dreamhost.com (Postfix) with ESMTP id B793685734; Sat, 7 Dec 2019 14:38:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=6JUzDkSwI6tmXW8bVWi5bfAcN+E=; b= aFb3+mT7bCc4HjaaQb/+hOwTPxbdlsT3DF2fgkZeJ6EUTc5kGTOBauHzx64YKQLU /VAiEdQmbsjs1ob+FH38bHjXegceD1whyxXDlcwtwKg+WBo92E6RppHPrRn86eBB 1csJCEtMWeXKhqel12bVsQIoON/kvL36YCtCtUo/KGw= Original-Received: from mail.jurta.org (m91-129-96-42.cust.tele2.ee [91.129.96.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a51.g.dreamhost.com (Postfix) with ESMTPSA id BA63C80283; Sat, 7 Dec 2019 14:38:48 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a51 In-Reply-To: <8736dyfk63.fsf@cochranmail.com> (Robert Cochran's message of "Thu, 05 Dec 2019 15:05:08 -0800") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 23.83.212.6 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:243223 Archived-At: > ;; From the examples in the last email > (#'tab-ex/kill-non-file-buffers-in-tab #'tab-ex/tab-has-unsaved-files) > > then when closing a tab, you'd first kill all of the non-file buffers, > and then check to see if you should close the tab based on whether or > not there are any visible unsaved buffers. But at this point, you've > already run cleanup functions regardless of whether or not you > ultimately decide to close the tab. Mixing cleanup tasks and deciding > whether or not to close the tab leads to weird edge-cases and being > dependent on function ordering. I think that's too much complexity to > wrangle in a single hook. Indeed, this is better than to depend on the ordering of function calls in the hook. > The only 'technical' problem with a post-close hook is that the tab > information is now gone because it's been deleted from the list. A hook > gets slightly less contextual information if we decide to hold off on > running the hook until the end. While I'll agree that it might make a > little more sense to run the hook at the end, I'm going to counter by > saying that we should arrange for the hook to be able to get as much > information as it can get, because you'll never know when someone wants > all of it. It's better to have to filter out information you don't need > than to be stuck without the information you do need. Right, more contextual information is available when the tab is still attached to the tab bar. > I tested this again just now and found out that it actually does work to > just get the alist from frame-parameter and modify it directly. I had an > incorrect understanding about what did and did not work. My appologies; > I thought I had tested that better. With that misunderstanding cleared > up, my original point is moot, and moving the call to > run-hooks-with-args to after the tab is put into the frame-parameters > list isn't problematic - life is still easy to modify tab parameters. Then let's agree on a general principle: both open and close hooks should operate on the tab when it is still attached to the tab bar. > I've fixed it in this version of the patch. Thanks, now your patch is pushed to master.