From 0522049864951fcb1231e80725a3c8d7d88605c6 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 7 Jul 2023 09:33:56 +0300 Subject: [PATCH] * 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. --- lisp/tab-bar.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 234e7e5d14d..f47c4a7bb6c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -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)) -- 2.39.5