unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: sbaugh@catern.com
Cc: 64373@debbugs.gnu.org, Spencer Baugh <sbaugh@janestreet.com>
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	[thread overview]
Message-ID: <86bkgra5et.fsf@mail.linkov.net> (raw)
In-Reply-To: <87a5wgokn4.fsf@catern.com> (sbaugh@catern.com's message of "Fri,  30 Jun 2023 18:44:17 +0000 (UTC)")

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tab-bar-minibuffer-restore-windows.patch --]
[-- Type: text/x-diff, Size: 1289 bytes --]

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))))
 
 \f
+(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))

  parent reply	other threads:[~2023-07-04 18:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 18:14 bug#64373: 29.0.90; C-x t o while in minibuffer copies the current tab to the next tab Spencer Baugh
2023-06-30 18:39 ` Juri Linkov
2023-06-30 18:44   ` sbaugh
2023-06-30 18:52     ` Juri Linkov
2023-07-03 17:18       ` Spencer Baugh
2023-07-03 18:58         ` Juri Linkov
2023-07-04 18:28     ` Juri Linkov [this message]
2023-07-05 17:21 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86bkgra5et.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=64373@debbugs.gnu.org \
    --cc=sbaugh@catern.com \
    --cc=sbaugh@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).