bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54038: 29.0.50; doc-view cannot show different pages in different ta


From: Juri Linkov
Subject: bug#54038: 29.0.50; doc-view cannot show different pages in different tabs
Date: Sat, 19 Feb 2022 19:31:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> Hmm, maybe 'C-x t n' should not reuse the same window,
> but should create a new window with exactly the same state.
> This will avoid such problems.  Ok, I'll try to use
> window-state-put/get while cloning tabs.

Here is attempt to create new windows with 'C-x t n'.
It works fine with (window-state-put (window-state-get))
to clone all windows in the tab (from the frame window).

But 'tab-bar-move-window-to-tab' still doesn't work
when it binds 'tab-bar-new-tab-choice' to 'window'.

The problem is that this doesn't create a new window
from the selected window:

  (window-state-put (window-state-get (selected-window)) (selected-window))

Maybe Martin could help.

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index e88bcac0da..7185cd52e8 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -481,7 +481,7 @@ tab-bar-new-tab-choice
 if such buffer exists, or switch to a buffer visiting the file or
 directory that the string specifies.  If the value is a function,
 call it with no arguments and switch to the buffer that it returns.
-If nil, duplicate the contents of the tab that was active
+If `clone', duplicate the contents of the tab that was active
 before calling the command that adds a new tab."
   :type '(choice (const     :tag "Current buffer" t)
                  (const     :tag "Current window" window)
@@ -489,7 +489,7 @@ tab-bar-new-tab-choice
                  (directory :tag "Directory" :value "~/")
                  (file      :tag "File" :value "~/.emacs")
                  (function  :tag "Function")
-                 (const     :tag "Duplicate tab" nil))
+                 (const     :tag "Duplicate tab" clone))
   :group 'tab-bar
   :version "27.1")
 
@@ -1367,14 +1367,19 @@ tab-bar-new-tab-to
         (select-window (minibuffer-selected-window)))
       ;; Remove window parameters that can cause problems
       ;; with `delete-other-windows' and `split-window'.
-      (set-window-parameter nil 'window-atom nil)
-      (set-window-parameter nil 'window-side nil)
+      (unless (eq tab-bar-new-tab-choice 'clone)
+        (set-window-parameter nil 'window-atom nil)
+        (set-window-parameter nil 'window-side nil))
       (let ((ignore-window-parameters t))
-        (delete-other-windows)
-        (unless (eq tab-bar-new-tab-choice 'window)
-          ;; Create a new window to get rid of old window parameters
-          ;; (e.g. prev/next buffers) of old window.
-          (split-window) (delete-window)))
+        (if (eq tab-bar-new-tab-choice 'clone)
+            (window-state-put (window-state-get))
+          (delete-other-windows)
+          (if (eq tab-bar-new-tab-choice 'window)
+              ;; TODO: this doesn't create a new window
+              (window-state-put (window-state-get (selected-window)) 
(selected-window))
+            ;; Create a new window to get rid of old window parameters
+            ;; (e.g. prev/next buffers) of old window.
+            (split-window) (delete-window))))
 
       (let ((buffer
              (if (functionp tab-bar-new-tab-choice)
@@ -1453,7 +1458,7 @@ tab-bar-duplicate-tab
   "Clone the current tab to ARG positions to the right.
 ARG and FROM-NUMBER have the same meaning as in `tab-bar-new-tab'."
   (interactive "P")
-  (let ((tab-bar-new-tab-choice nil)
+  (let ((tab-bar-new-tab-choice 'clone)
         (tab-bar-new-tab-group t))
     (tab-bar-new-tab arg from-number)))
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]