* lisp/tab-bar.el: Improve tab-bar-minibuffer-restore-tab (bug#64373).

(tab-bar-select-tab): Set tab-bar-minibuffer-restore-tab and
minibuffer-exit-hook minibuffer-locally to handle recursive minibuffers
for non-nil read-minibuffer-restore-windows.
(tab-bar-minibuffer-restore-tab): No need to reset minibuffer-local values.
This commit is contained in:
Juri Linkov 2023-07-07 09:33:56 +03:00
parent 3cea0a8490
commit 0522049864

View file

@ -1261,10 +1261,8 @@ inherits the current tab's `explicit-name' parameter."
This is necessary to prepare the same window configuration where
original windows were saved and will be restored. This function
is used only when `read-minibuffer-restore-windows' is non-nil."
(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)))
(when tab-bar-minibuffer-restore-tab
(tab-bar-select-tab tab-bar-minibuffer-restore-tab)))
(defun tab-bar-select-tab (&optional tab-number)
"Switch to the tab by its absolute position TAB-NUMBER in the tab bar.
@ -1293,8 +1291,8 @@ Negative TAB-NUMBER counts tabs from the end of the tab bar."
(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-tab))
(setq-local tab-bar-minibuffer-restore-tab (1+ from-index))
(add-hook 'minibuffer-exit-hook 'tab-bar-minibuffer-restore-tab nil t))
(unless (eq from-index to-index)
(let* ((from-tab (tab-bar--tab))