]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow creating a new tab for tab-switcher from the minibuffer (bug#45072)
authorJuri Linkov <juri@linkov.net>
Mon, 14 Dec 2020 08:52:05 +0000 (10:52 +0200)
committerJuri Linkov <juri@linkov.net>
Mon, 14 Dec 2020 08:52:05 +0000 (10:52 +0200)
* 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.

lisp/tab-bar.el

index 1327bde908880394207010be048473bfc1a0801a..3a705aa015d6b1a711e4568ab65b3edb5bbd3cf4 100644 (file)
@@ -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))