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#64373: 29.0.90; C-x t o while in minibuffer copies the current tab to the next tab Date: Tue, 04 Jul 2023 21:28:18 +0300 Organization: LINKOV.NET Message-ID: <86bkgra5et.fsf@mail.linkov.net> References: <86mt0gdcb4.fsf@mail.linkov.net> <87a5wgokn4.fsf@catern.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32321"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 64373@debbugs.gnu.org, Spencer Baugh To: sbaugh@catern.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 04 20:41:16 2023 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 1qGkxg-0008KJ-N7 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jul 2023 20:41:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGkxT-0005Tj-Kc; Tue, 04 Jul 2023 14:41:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGkxS-0005TU-Aj for bug-gnu-emacs@gnu.org; Tue, 04 Jul 2023 14:41:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGkxS-0003En-2R for bug-gnu-emacs@gnu.org; Tue, 04 Jul 2023 14:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qGkxR-0006fS-Ud for bug-gnu-emacs@gnu.org; Tue, 04 Jul 2023 14:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jul 2023 18:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64373 X-GNU-PR-Package: emacs Original-Received: via spool by 64373-submit@debbugs.gnu.org id=B64373.168849600725543 (code B ref 64373); Tue, 04 Jul 2023 18:41:01 +0000 Original-Received: (at 64373) by debbugs.gnu.org; 4 Jul 2023 18:40:07 +0000 Original-Received: from localhost ([127.0.0.1]:36618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qGkwY-0006dv-Jp for submit@debbugs.gnu.org; Tue, 04 Jul 2023 14:40:06 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:57797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qGkwW-0006dH-5f for 64373@debbugs.gnu.org; Tue, 04 Jul 2023 14:40:05 -0400 X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 93B0360004; Tue, 4 Jul 2023 18:39:56 +0000 (UTC) In-Reply-To: <87a5wgokn4.fsf@catern.com> (sbaugh@catern.com's message of "Fri, 30 Jun 2023 18:44:17 +0000 (UTC)") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264605 Archived-At: --=-=-= Content-Type: text/plain > We should also restore the current tab, then. Because right now we're > restoring the window configuration, but not the current tab. > > If we did that, then this would behave as expected: We'd restore the > current tab, then restore the window configuration in that tab. I was unaware about this problem because I have customized read-minibuffer-restore-windows to nil. Now that you found the problem, I looked at it from the point of view of users who don't mind the default value t of read-minibuffer-restore-windows, and agree now that for read-minibuffer-restore-windows to continue doing what it's intended to do, the only way is to switch to the original tab back. Here is a preliminary patch that might need more testing: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tab-bar-minibuffer-restore-windows.patch diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 87ca80ce00a..f0668374773 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1253,6 +1260,14 @@ tab-bar--tabs-recent tabs)))) +(defvar tab-bar-minibuffer-restore-tab nil) + +(defun tab-bar-minibuffer-restore-windows () + (when (and read-minibuffer-restore-windows + tab-bar-minibuffer-restore-tab) + (tab-bar-select-tab tab-bar-minibuffer-restore-tab) + (setq tab-bar-minibuffer-restore-tab nil))) + (defun tab-bar-select-tab (&optional tab-number) "Switch to the tab by its absolute position TAB-NUMBER in the tab bar. When this command is bound to a numeric key (with a key prefix or modifier key @@ -1278,6 +1293,11 @@ tab-bar-select-tab (to-index (1- (max 1 (min to-number (length tabs))))) (minibuffer-was-active (minibuffer-window-active-p (selected-window)))) + (when (and read-minibuffer-restore-windows minibuffer-was-active + (not tab-bar-minibuffer-restore-tab)) + (setq tab-bar-minibuffer-restore-tab (1+ from-index)) + (add-hook 'minibuffer-exit-hook 'tab-bar-minibuffer-restore-windows)) + (unless (eq from-index to-index) (let* ((from-tab (tab-bar--tab)) (to-tab (nth to-index tabs)) --=-=-=--