unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 54038@debbugs.gnu.org
Subject: bug#54038: 29.0.50; doc-view cannot show different pages in different tabs
Date: Sat, 19 Feb 2022 19:31:06 +0200	[thread overview]
Message-ID: <86o832yd9h.fsf@mail.linkov.net> (raw)
In-Reply-To: <86r180mxss.fsf@mail.linkov.net> (Juri Linkov's message of "Fri,  18 Feb 2022 09:46:03 +0200")

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tab-bar-new-tab-choice-clone.patch --]
[-- Type: text/x-diff, Size: 2721 bytes --]

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	other threads:[~2022-02-19 17:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  9:18 bug#54038: 29.0.50; doc-view cannot show different pages in different tabs Visuwesh
2022-02-17 18:12 ` Juri Linkov
2022-02-18  1:06   ` Visuwesh
2022-02-18  7:46     ` Juri Linkov
2022-02-19 17:31       ` Juri Linkov [this message]
2022-02-20  9:17         ` martin rudalics
2022-02-23 17:59           ` Juri Linkov
2022-02-18  8:11     ` Juri Linkov
2022-02-18 12:19       ` Visuwesh
2022-02-19 17:35       ` Juri Linkov
2022-02-20  9:17         ` martin rudalics
2022-02-20 18:51           ` Juri Linkov
2022-02-21  9:08             ` martin rudalics
2022-02-23 17:46               ` Juri Linkov
2022-02-24  9:18                 ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o832yd9h.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=54038@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).