From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#51935: 29.0.50; tab-switch hides identically named tabs Date: Sat, 20 Nov 2021 21:42:12 +0200 Organization: LINKOV.NET Message-ID: <86ee7amuur.fsf@mail.linkov.net> References: <86r1bdxvt8.fsf@mail.linkov.net> <86a6i0o8dj.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18538"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 51935@debbugs.gnu.org To: Carlos Pita Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 20 21:34:09 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1moX3o-0004eF-K0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Nov 2021 21:34:08 +0100 Original-Received: from localhost ([::1]:58198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1moX3n-0003WN-Ml for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Nov 2021 15:34:07 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1moX3i-0003W3-8C for bug-gnu-emacs@gnu.org; Sat, 20 Nov 2021 15:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1moX3h-0000SV-VZ for bug-gnu-emacs@gnu.org; Sat, 20 Nov 2021 15:34:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1moX3h-0006N5-Mi for bug-gnu-emacs@gnu.org; Sat, 20 Nov 2021 15:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Nov 2021 20:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51935 X-GNU-PR-Package: emacs Original-Received: via spool by 51935-submit@debbugs.gnu.org id=B51935.163744041824357 (code B ref 51935); Sat, 20 Nov 2021 20:34:01 +0000 Original-Received: (at 51935) by debbugs.gnu.org; 20 Nov 2021 20:33:38 +0000 Original-Received: from localhost ([127.0.0.1]:43740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1moX3K-0006Kl-DW for submit@debbugs.gnu.org; Sat, 20 Nov 2021 15:33:38 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:45373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1moX3F-0006K8-Nl for 51935@debbugs.gnu.org; Sat, 20 Nov 2021 15:33:36 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 7198840002; Sat, 20 Nov 2021 20:33:25 +0000 (UTC) In-Reply-To: (Carlos Pita's message of "Sat, 20 Nov 2021 00:17:22 -0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:220520 Archived-At: >> But the problem is that 'C-x t RET' is used mostly when the tab-bar >> is disabled and not visible, so tabs are not positional in this case. > > But there still is the underlying order used by C-TAB/S-C-TAB, isn't it? C-TAB/S-C-TAB keys are enabled only when tab-bar-mode is enabled. > Depending on the configured completion framework C-x t RET will show > candidates in order or not, but the interpretation of the suffix as a > position seems relatively clear to me even in the unordered case, if > not anything else at least it's an indication that there are > additional tabs with the same name. This could be implemented like below. But it still messes the text properties of the selected completion candidate, even with using minibuffer-allow-text-properties, so something is broken in the default completion framework. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 1a1d0b1ea5..0590b5fe7c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1198,13 +1198,24 @@ tab-bar-switch-to-tab to get the name of the most recently visited tab, the second most recent, and so on." (interactive - (let* ((recent-tabs (mapcar (lambda (tab) - (alist-get 'name tab)) - (tab-bar--tabs-recent)))) + (let* ((names '()) (i 1) + (recent-tabs + (mapcar (lambda (tab) + (let ((name (alist-get 'name tab))) + (if (member name names) + (setq name (format "%s<%s>" name i)) + (setq name (copy-sequence name)) + (push name names)) + (setq i (1+ i)) + (propertize name 'tab tab))) + (tab-bar--tabs-recent))) + (minibuffer-allow-text-properties t)) (list (completing-read (format-prompt "Switch to tab by name" (car recent-tabs)) recent-tabs nil nil nil nil recent-tabs)))) - (tab-bar-select-tab (1+ (or (tab-bar--tab-index-by-name name) 0)))) + (let ((tab (get-text-property 0 'tab name))) + (tab-bar-select-tab (1+ (or (and tab (tab-bar--tab-index tab)) + (tab-bar--tab-index-by-name name) 0))))) (defalias 'tab-bar-select-tab-by-name 'tab-bar-switch-to-tab) --