1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-16 00:01:05 -08:00

Support the reusable-frames' value 0 for display-buffer-in-tab'

* lisp/tab-bar.el (tab-bar--reusable-frames): Implement support for the
`reusable-frames' value 0, for better consistency with other buffer
display actions. (bug#80092)
This commit is contained in:
Phil Sainty 2026-01-01 21:28:59 +13:00
parent 99750f9fdf
commit bb43055ef0
2 changed files with 17 additions and 0 deletions

View file

@ -3580,6 +3580,8 @@ which already displays the buffer. The possible values of
means consider all existing frames.
@item @code{visible}
means consider all visible frames.
@item 0
means consider all frames on the current terminal.
@item A frame
means consider that frame only.
@item Any other non-@code{nil} value

View file

@ -2865,9 +2865,20 @@ with those specified by the selected window configuration."
(defun tab-bar--reusable-frames (all-frames)
"Process the `reusable-frames' buffer display action alist entry.
Return a frame list. Used with the `display-buffer-in-tab' action."
(cond
((eq all-frames t) (frame-list))
((eq all-frames 'visible) (visible-frame-list))
;; The standard behavior for a `reusable-frames' value of 0 is implemented in
;; candidate_window_p() in window.c, and we have to go via `window-list-1' to
;; utilize this. We list the selected frame first.
((eq all-frames 0) (let (frames)
(dolist (w (window-list-1 nil nil 0))
(let ((f (window-frame w)))
(unless (memq f frames)
(push f frames))))
(nreverse frames)))
((framep all-frames) (list all-frames))
(t (list (selected-frame)))))
@ -2883,6 +2894,9 @@ The optional argument ALL-FRAMES specifies the frames to consider:
- `visible' means consider all tabs on all visible frames.
- 0 (the number zero) means consider all tabs on all visible and
iconified frames.
- A frame means consider all tabs on that frame only.
- Any other value of ALL-FRAMES means consider all tabs on the
@ -2941,6 +2955,7 @@ displays BUFFER. The possible values of `reusable-frames' are:
t -- all existing frames;
`visible' -- all visible frames;
0 -- all frames on the current terminal;
A frame -- that frame only;
Any other non-nil value -- the selected frame;
nil -- do not search any frames (equivalent to omitting the entry).