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, 10 Nov 2019 22:42:15 +0200 Organization: LINKOV.NET Message-ID: <87r22fzhag.fsf@mail.linkov.net> References: <87h83egmzy.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="142929"; 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: emacs-devel@gnu.org To: Robert Cochran Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 10 21:56:31 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 1iTuG6-000b18-Dc for ged-emacs-devel@m.gmane.org; Sun, 10 Nov 2019 21:56:30 +0100 Original-Received: from localhost ([::1]:45862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTuG5-0001RU-6T for ged-emacs-devel@m.gmane.org; Sun, 10 Nov 2019 15:56:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49379) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTuFu-0001HH-19 for emacs-devel@gnu.org; Sun, 10 Nov 2019 15:56:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTuFs-0002E4-Oj for emacs-devel@gnu.org; Sun, 10 Nov 2019 15:56:17 -0500 Original-Received: from blue.elm.relay.mailchannels.net ([23.83.212.20]:7499) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iTuFs-0002Cv-Er for emacs-devel@gnu.org; Sun, 10 Nov 2019 15:56:16 -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 0E2E08C1463; Sun, 10 Nov 2019 20:56:15 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a14.g.dreamhost.com (100-96-92-150.trex.outbound.svc.cluster.local [100.96.92.150]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9F38A8C10C2; Sun, 10 Nov 2019 20:56:14 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a14.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); Sun, 10 Nov 2019 20:56:14 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Belong-Ruddy: 6926054e14a94b7a_1573419374869_2420504697 X-MC-Loop-Signature: 1573419374869:700737096 X-MC-Ingress-Time: 1573419374868 Original-Received: from pdx1-sub0-mail-a14.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a14.g.dreamhost.com (Postfix) with ESMTP id 5C4A498266; Sun, 10 Nov 2019 12:56:09 -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=kwS9yyyZhc2qlMRsXXz/5lj25WM=; b= trFMU7OvLY0LPrSX1ocCZb+f09MM59KsQHDZefdwj+yVJsFlWrDQJAo0lai1sJW7 zJJS2GpyIgjARxG//ntGCb3kG74cCb6ZJNUFmC3fmAUsWVkrJIlDwSzUIqDv3XEv gZCs/eDvO+C8ZqfLQwXxI/AwKE11WY3dI+5c5Lx7xGI= Original-Received: from mail.jurta.org (m91-129-102-1.cust.tele2.ee [91.129.102.1]) (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-a14.g.dreamhost.com (Postfix) with ESMTPSA id B05879633F; Sun, 10 Nov 2019 12:56:07 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a14 In-Reply-To: <87h83egmzy.fsf@cochranmail.com> (Robert Cochran's message of "Fri, 08 Nov 2019 11:57:05 -0800") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 23.83.212.20 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:242075 Archived-At: > New defcustoms, tab-bar-post-open-functions and > tab-bar-pre-close-functions. Call all of the function in > post-open-functions at the end of tab-bar-new-tab-to, passing in the new > tab as an argument. Similar for pre-close-functions, but slightly more > complicated to lend some expressive power. Each of the functions take 2 > arguments, the tab itself, and a flag indicating whether or not it's the > last tab. The big thing is that the return values are kept track of, and > if *any* of the functions return a non-nil value > (ie `(cl-some (mapcar (lambda (x) (funcall x tab last-tab))) pre-close-functions)` > is non-nil), it short-circuits and doesn't run the rest of > tab-bar-close-tab. Also similar to run-hook-with-args-until-success. > This would be useful to provide to users so that they can do other > clean-up tasks when the tab is closed, as well as providing a way to > protect a tab from being closed. Ditto for being able to do some tab > set-up when you open a new tab. Please bring up some examples of usages for these options because without examples it's hard to understand how these options are intended to be used, e.g. how to rename a new tab after creating, or do a clean-up task on closing, or prevent from closing, etc. > This is going to take some additional work. I couldn't think of a clean > way to gracefully provide a way to easily make permanent changes to the > tab for the purposes of tab-bar-post-open-functions - the functions > within have to grovel through the tabs frame parameter and write back a value > themselves. I personally don't find this an optimal user experience, but > feedback on that point is welcome. But you provide a new tab as a parameter to tab-bar-post-open-functions. Could it be used to make changes in a new tab? > Patch follows. Thanks.