From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 53662@debbugs.gnu.org, Aaron Jensen <aaronjensen@gmail.com>
Subject: bug#53662: 29.0.50; Cannot use tab-new from side window
Date: Wed, 02 Feb 2022 21:37:09 +0200 [thread overview]
Message-ID: <86tudhxe5u.fsf@mail.linkov.net> (raw)
In-Reply-To: <414b9299-8c93-e1d6-5b2e-226023692a0a@gmx.at> (martin rudalics's message of "Wed, 2 Feb 2022 08:47:18 +0100")
[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]
> Two caveats:
>
> + (dolist (parameter (window-parameters))
> + (set-window-parameter nil (car parameter) nil))
>
> Maybe you should remove the 'window-side' and the 'window-atom'
> parameters only - users can assign arbitrary parameters to windows.
If other window parameters are harmless, then only these two could be
removed.
> + (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)))
>
> Note that this will lose other settings as well like the window's
> dedicated status. If this is the intended behavior, you should at least
> tell so in the doc-string.
If you mean the case when tab-bar-new-tab-choice is 'window',
then it will lose only 'window-atom' and 'window-side', because
the value 'window' is intended to keep a single window on the tab.
In other cases at this point, all windows were already saved to
window-configuration, so this window is disposable and can be modified
before immediately deleting it. After saving windows to
window-configuration, the task here is just to create a new window.
So now a new patch with the updated doc-string:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tab-new-window-side.patch --]
[-- Type: text/x-diff, Size: 2268 bytes --]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 06ad8f60af..e611711092 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -474,6 +474,9 @@ tab-bar-new-tab-choice
If t, start a new tab with the current buffer, i.e. the buffer
that was current before calling the command that adds a new tab
(this is the same what `make-frame' does by default).
+If the value is the symbol `window', then keep the selected
+window as a single window on the new tab, and keep all its
+window parameters except 'window-atom' and 'window-side'.
If the value is a string, use it as a buffer name to switch to
if such buffer exists, or switch to a buffer visiting the file or
directory that the string specifies. If the value is a function,
@@ -481,6 +484,7 @@ tab-bar-new-tab-choice
If nil, 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)
(string :tag "Buffer" "*scratch*")
(directory :tag "Directory" :value "~/")
(file :tag "File" :value "~/.emacs")
@@ -1361,12 +1365,17 @@ tab-bar-new-tab-to
;; Handle the case when it's called in the active minibuffer.
(when (minibuffer-selected-window)
(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)
(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))
+ (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)))
+
(let ((buffer
(if (functionp tab-bar-new-tab-choice)
(funcall tab-bar-new-tab-choice)
next prev parent reply other threads:[~2022-02-02 19:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 15:25 bug#53662: 29.0.50; Cannot use tab-new from side window Aaron Jensen
2022-01-31 18:15 ` Juri Linkov
2022-02-01 8:09 ` martin rudalics
2022-02-01 19:31 ` Juri Linkov
2022-02-02 7:47 ` martin rudalics
2022-02-02 19:37 ` Juri Linkov [this message]
2022-02-06 17:55 ` Juri Linkov
2022-02-06 19:03 ` Aaron Jensen
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=86tudhxe5u.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=53662@debbugs.gnu.org \
--cc=aaronjensen@gmail.com \
--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).