From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: C-x t N Date: Mon, 06 Sep 2021 18:58:30 +0300 Message-ID: <83v93dr909.fsf@gnu.org> References: <83k0jurtj5.fsf@gnu.org> <87lf49j0ww.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4211"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 06 17:59:16 2021 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 1mNH1g-0000rW-OP for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Sep 2021 17:59:16 +0200 Original-Received: from localhost ([::1]:40638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNH1e-0002VX-VT for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Sep 2021 11:59:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNH0s-0001Ab-L4 for emacs-devel@gnu.org; Mon, 06 Sep 2021 11:58:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43866) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNH0s-0007Ug-1c; Mon, 06 Sep 2021 11:58:26 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2990 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNH0r-0006tt-Hl; Mon, 06 Sep 2021 11:58:25 -0400 In-Reply-To: <87lf49j0ww.fsf@mail.linkov.net> (message from Juri Linkov on Mon, 06 Sep 2021 18:22:31 +0300) 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274143 Archived-At: > From: Juri Linkov > Cc: emacs-devel@gnu.org > Date: Mon, 06 Sep 2021 18:22:31 +0300 > > > NEWS says: > > > > *** 'C-x t N' creates a new tab at the specified absolute position. > > It also supports a negative argument. > > > > The doc string says: > > > > 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’. > > Negative TO-INDEX counts tabs from the end of the tab bar. > > > > I think the interpretation of the negative values here is > > counter-intuitive, because using -1 will add a new tab to the right of > > the rightmost tab, and if that's what is meant by "from the end of the > > tab bar", then what exactly is "the end of the tab bar" needs to be > > explicitly documented. > > I see you already fixed this by adding this text: > > "and -1 means the new tab will become the last one" > > I confirm this is correct. The text I added just describes what the implementation does, but is that reasonable? Any such scheme should make sense, otherwise people will have trouble memorizing it, will make mistakes, and will only know how to DTRT after they read the fine print of the doc string. Here's the problem: if index = 1 means "the first tab", then -1 which "counts from the end" is not the last one, it's one before that. The semantics of -1 being the last one would work if the index of the first were zero, not 1. And the fact that the code needs to add 1 and subtract 1 while handling this tells me that the concept as implemented is problematic. I mean this code: (let* (... (to-index (or (if to-index (if (< to-index 0) (+ (length tabs) (1+ to-index)) (1- to-index)))