From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 38354@debbugs.gnu.org
Subject: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
Date: Tue, 03 Dec 2019 01:43:02 +0200 [thread overview]
Message-ID: <87h82i9tvd.fsf@mail.linkov.net> (raw)
In-Reply-To: <6be9eb15-062d-b15f-04c8-993a2a2eee22@gmx.at> (martin rudalics's message of "Mon, 2 Dec 2019 10:40:14 +0100")
[-- Attachment #1: Type: text/plain, Size: 2359 bytes --]
> With "moving" I really meant "copying" or "cloning" with the
> additional possibility of deleting the original. So there should be
> only one question: Can we simply make a copy of a tab using its window
> state (window configurations can't be used because we cannot clone
> windows). If not, what is the problem?
Implemented in the patch below that deletes the window-configuration
from the copied tab, but leaves its window-state.
>> An additional question to consider is how to interactively select
>> an another frame: by frame name, or using other-frame with a numeric
>> prefix argument?
>
> How is this question related to tabs?
Easier to implement than to explain :) The same patch uses its ARG
the same way as it's used in 'other-frame' to find ARGth frame
where to copy the tab.
>> (push '("test1" .
>> (display-buffer-reuse-window
>> (reusable-frames . visible)
>> (use-tabs . t)))
>> display-buffer-alist)
>
> There is one thing I apparently do not understand yet: When you enable
> 'tab-bar-mode' it is global
Do you think we should have 'global-tab-bar-mode' for all frames,
and 'tab-bar-mode' to enable/disable the tab-bar in every frame
separately?
> - that is any window ever shown on any frame is also in at least one
> of that frame's tabs. Is that right? So what would 'use-tabs' mean
> here when every window is in a tab already?
These windows in tabs are in window-configurations and window-states.
Now I installed tab-bar-get-buffer-tab that can be used
in display-buffer-reuse-window to search the buffer
in window-states of tabs when use-tabs is non-nil.
>>> By default, a new tab starts with the current buffer that was current
>>> before calling the command that adds a new tab.
>>>
>>> That's confusing, at least.
>>
>> Maybe this is better?
>>
>> By default, a new tab starts with the buffer that was current
>> before calling the command that adds a new tab.
>
> The current buffer is IMHO a much too obscure object to consider here.
> Don't you mean the buffer of the selected window?
The manual refers to the default value of tab-bar-new-tab-choice
with its docstring:
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).
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tab-bar-move-tab-to-frame.patch --]
[-- Type: text/x-diff, Size: 1767 bytes --]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index a36be13e37..340f012247 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -645,6 +645,33 @@ tab-bar-move-tab
(to-index (mod (+ from-index arg) (length tabs))))
(tab-bar-move-tab-to (1+ to-index) (1+ from-index))))
+(defun tab-bar-move-tab-to-frame (arg &optional from-frame from-index to-frame to-index)
+ "Move tab from FROM-INDEX position to new position at TO-INDEX.
+FROM-INDEX defaults to the current tab index.
+FROM-INDEX and TO-INDEX count from 1.
+FROM-FRAME specifies the source frame and defaults to the selected frame.
+TO-FRAME specifies the target frame and defaults the next frame.
+Interactively, ARG selects the ARGth different frame to move to."
+ (interactive "P")
+ (unless from-frame
+ (setq from-frame (selected-frame)))
+ (unless to-frame
+ (dotimes (_ (prefix-numeric-value arg))
+ (setq to-frame (next-frame to-frame))))
+ (unless (eq from-frame to-frame)
+ (let* ((from-tabs (with-selected-frame from-frame
+ (funcall tab-bar-tabs-function)))
+ (from-index (or from-index (1+ (tab-bar--current-tab-index from-tabs))))
+ (from-tab (nth (1- from-index) from-tabs))
+ (to-tabs (with-selected-frame to-frame
+ (funcall tab-bar-tabs-function)))
+ (to-index (max 0 (min (1- (or to-index 1)) (1- (length to-tabs))))))
+ (setq from-tabs (delq from-tab from-tabs))
+ (cl-pushnew (assq-delete-all 'wc from-tab) (nthcdr to-index to-tabs))
+ (set-frame-parameter from-frame 'tabs from-tabs)
+ (set-frame-parameter to-frame 'tabs to-tabs)
+ (force-mode-line-update t))))
+
\f
(defcustom tab-bar-new-tab-to 'right
"Defines where to create a new tab.
next prev parent reply other threads:[~2019-12-02 23:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 23:09 bug#38354: 27.0.50; Implement display action display-buffer-in-tab Juri Linkov
2019-11-26 9:32 ` martin rudalics
2019-11-26 22:30 ` Juri Linkov
2019-11-26 22:43 ` Juri Linkov
2019-11-27 9:49 ` martin rudalics
2019-11-27 21:37 ` Juri Linkov
2019-11-28 9:20 ` martin rudalics
2019-11-28 23:02 ` Juri Linkov
2019-11-29 9:24 ` martin rudalics
2019-12-01 22:29 ` Juri Linkov
2019-12-02 9:40 ` martin rudalics
2019-12-02 23:43 ` Juri Linkov [this message]
2019-12-03 9:18 ` martin rudalics
2019-12-03 23:36 ` Juri Linkov
2019-12-04 9:22 ` martin rudalics
2019-12-04 22:51 ` Juri Linkov
2019-12-05 9:05 ` martin rudalics
2019-12-05 23:54 ` Juri Linkov
2019-12-06 7:37 ` martin rudalics
2022-12-06 17:40 ` Juri Linkov
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=87h82i9tvd.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=38354@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).