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] Document tab opening/closing hooks and variables Date: Wed, 11 Dec 2019 10:15:14 -0800 Message-ID: <8736dqk9u5.fsf@cochranmail.com> References: <878snjeuhk.fsf@cochranmail.com> <83mubyai59.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="184767"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Robert Cochran , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 11 19:16:00 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 1if6Wm-000lsj-JM for ged-emacs-devel@m.gmane.org; Wed, 11 Dec 2019 19:16:00 +0100 Original-Received: from localhost ([::1]:47618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if6Wl-0006SQ-4a for ged-emacs-devel@m.gmane.org; Wed, 11 Dec 2019 13:15:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58664) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if6WJ-00061c-DU for emacs-devel@gnu.org; Wed, 11 Dec 2019 13:15:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1if6WI-0005j3-4a for emacs-devel@gnu.org; Wed, 11 Dec 2019 13:15:31 -0500 Original-Received: from mail.cochranmail.com ([64.140.150.170]:41442) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1if6WG-0005d0-4q; Wed, 11 Dec 2019 13:15:28 -0500 Original-Received: from SoraLaptop (unknown [71.212.134.29]) (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 D8490777; Wed, 11 Dec 2019 10:15:22 -0800 (PST) In-Reply-To: <83mubyai59.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 11 Dec 2019 19:25:54 +0200") 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:243307 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Robert Cochran >> Date: Tue, 10 Dec 2019 13:33:27 -0800 >> >> As promised, I've written information on tab-bar-post-open-functions, >> tab-bar-close-last-tab-choice, tab-bar-prevent-close-functions, and >> tab-bar-post-close-functions in the manual. >> >> Suggestions and comments welcome, as usual. > > Thanks. > > I wonder whether such facilities need to be described in the manual. > They sound pretty minor features, so perhaps we should let users > discover them via Custom, doc strings, and NEWS? I put them in the manual because I said that I would. I can't speak for everyone, but sometimes stuff like that is nice to have in the manual. I don't often discover variables via custom, but that might be because I generally have a specific thing I have in mind I want to change when I use it. Such a thing definitely should be mentioned in the docstrings for the functions, which I entirely forgot to write in both this patch and the last patch. Oops. Here's a rough patch for that. I think if anything else, that putting a couple of mentions in the docstrings of some of the entry point functions is a reasonable compromise. Thanks, -- ~Robert Cochran --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Document-variables-that-affect-tabs-in-function-docs.patch Content-Description: Document tab-affecting variables in docstrings >From c6c4ae57b985bf9bd604613a173819fe725df761 Mon Sep 17 00:00:00 2001 From: Robert Cochran Date: Wed, 11 Dec 2019 10:04:06 -0800 Subject: [PATCH] Document variables that affect tabs in function docstrings * lisp/tab-bar.el (tab-bar-new-tab-to): Mention tab-bar-post-open-functions in docstring. (tab-bar-close-tab): Mention tab-bar-prevent-tab-functions, tab-bar-tab-pre-close-functions, and tab-bar-close-last-tab-choice. --- lisp/tab-bar.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index ba4bc0afcd..7e8f56de2a 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -704,7 +704,10 @@ tab-bar-tab-post-open-functions (defun tab-bar-new-tab-to (&optional to-index) "Add a new tab at the absolute position TO-INDEX. TO-INDEX counts from 1. If no TO-INDEX is specified, then add -a new tab at the position specified by `tab-bar-new-tab-to'." +a new tab at the position specified by `tab-bar-new-tab-to'. + +After the tab is created, the hooks in +`tab-bar-tab-post-open-functions' are run." (interactive "P") (let* ((tabs (funcall tab-bar-tabs-function)) (from-index (tab-bar--current-tab-index tabs)) @@ -819,7 +822,14 @@ tab-bar-close-tab Optional TO-INDEX could be specified to override the value of `tab-bar-close-tab-select' programmatically with a position of an existing tab to select after closing the current tab. -TO-INDEX counts from 1." +TO-INDEX counts from 1. + +The functions in `tab-bar-tab-prevent-close-functions' will be +run to determine whether or not to close the tab. +Just before the tab is closed, the functions in +`tab-bar-tab-pre-close-functions' will be run. The base behavior +for the last tab on a frame is determined by +`tab-bar-close-last-tab-choice'." (interactive "P") (let* ((tabs (funcall tab-bar-tabs-function)) (current-index (tab-bar--current-tab-index tabs)) -- 2.23.0 --=-=-=--