From: Juri Linkov Date: Mon, 14 Dec 2020 08:52:05 +0000 (+0200) Subject: Allow creating a new tab for tab-switcher from the minibuffer (bug#45072) X-Git-Tag: emacs-28.0.90~4728 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e948cdbfa8508c7fc98a39caaf5e46798e6a3939;p=emacs.git Allow creating a new tab for tab-switcher from the minibuffer (bug#45072) * lisp/tab-bar.el (tab-switcher): Simplify by let-binding tab-bar-new-tab-choice to t before calling tab-bar-new-tab that handles the case when it's called in the active minibuffer. --- diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 1327bde9088..3a705aa015d 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -762,6 +762,7 @@ After the tab is created, the hooks in (from-tab (tab-bar--tab))) (when tab-bar-new-tab-choice + ;; Handle the case when it's called in the active minibuffer. (when (minibuffer-selected-window) (select-window (minibuffer-selected-window))) (delete-other-windows) @@ -1200,18 +1201,11 @@ Type q to remove the list of window configurations from the display. The first column shows `D' for a window configuration you have marked for deletion." (interactive) - (let ((dir default-directory) - (minibuf (minibuffer-selected-window))) - (let ((tab-bar-show nil)) ; don't enable tab-bar-mode if it's disabled + (let ((dir default-directory)) + (let ((tab-bar-new-tab-choice t) + ;; Don't enable tab-bar-mode if it's disabled + (tab-bar-show nil)) (tab-bar-new-tab)) - ;; Handle the case when it's called in the active minibuffer. - (when minibuf (select-window (minibuffer-selected-window))) - (delete-other-windows) - ;; Create a new window to replace the existing one, to not break the - ;; window parameters (e.g. prev/next buffers) of the window just saved - ;; to the window configuration. So when a saved window is restored, - ;; its parameters left intact. - (split-window) (delete-window) (let ((switch-to-buffer-preserve-window-point nil)) (switch-to-buffer (tab-switcher-noselect))) (setq default-directory dir))