aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sainty2026-01-01 21:28:59 +1300
committerPhil Sainty2026-01-03 14:09:28 +1300
commitbb43055ef08049fa3a1694b7769adbade762c17d (patch)
treed6ad9176e72a0db460c213f86fdf9735768192fc
parent99750f9fdff60110e8289b2ba975b10df62462bf (diff)
downloademacs-bb43055ef08049fa3a1694b7769adbade762c17d.tar.gz
emacs-bb43055ef08049fa3a1694b7769adbade762c17d.zip
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)
-rw-r--r--doc/lispref/windows.texi2
-rw-r--r--lisp/tab-bar.el15
2 files changed, 17 insertions, 0 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index dd0d925ed7e..09d58c17c01 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -3580,6 +3580,8 @@ which already displays the buffer. The possible values of
3580means consider all existing frames. 3580means consider all existing frames.
3581@item @code{visible} 3581@item @code{visible}
3582means consider all visible frames. 3582means consider all visible frames.
3583@item 0
3584means consider all frames on the current terminal.
3583@item A frame 3585@item A frame
3584means consider that frame only. 3586means consider that frame only.
3585@item Any other non-@code{nil} value 3587@item Any other non-@code{nil} value
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 5c63de5e39f..f9df4110757 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -2865,9 +2865,20 @@ with those specified by the selected window configuration."
2865 2865
2866 2866
2867(defun tab-bar--reusable-frames (all-frames) 2867(defun tab-bar--reusable-frames (all-frames)
2868 "Process the `reusable-frames' buffer display action alist entry.
2869Return a frame list. Used with the `display-buffer-in-tab' action."
2868 (cond 2870 (cond
2869 ((eq all-frames t) (frame-list)) 2871 ((eq all-frames t) (frame-list))
2870 ((eq all-frames 'visible) (visible-frame-list)) 2872 ((eq all-frames 'visible) (visible-frame-list))
2873 ;; The standard behavior for a `reusable-frames' value of 0 is implemented in
2874 ;; candidate_window_p() in window.c, and we have to go via `window-list-1' to
2875 ;; utilize this. We list the selected frame first.
2876 ((eq all-frames 0) (let (frames)
2877 (dolist (w (window-list-1 nil nil 0))
2878 (let ((f (window-frame w)))
2879 (unless (memq f frames)
2880 (push f frames))))
2881 (nreverse frames)))
2871 ((framep all-frames) (list all-frames)) 2882 ((framep all-frames) (list all-frames))
2872 (t (list (selected-frame))))) 2883 (t (list (selected-frame)))))
2873 2884
@@ -2883,6 +2894,9 @@ The optional argument ALL-FRAMES specifies the frames to consider:
2883 2894
2884- `visible' means consider all tabs on all visible frames. 2895- `visible' means consider all tabs on all visible frames.
2885 2896
2897- 0 (the number zero) means consider all tabs on all visible and
2898 iconified frames.
2899
2886- A frame means consider all tabs on that frame only. 2900- A frame means consider all tabs on that frame only.
2887 2901
2888- Any other value of ALL-FRAMES means consider all tabs on the 2902- 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:
2941 2955
2942 t -- all existing frames; 2956 t -- all existing frames;
2943 `visible' -- all visible frames; 2957 `visible' -- all visible frames;
2958 0 -- all frames on the current terminal;
2944 A frame -- that frame only; 2959 A frame -- that frame only;
2945 Any other non-nil value -- the selected frame; 2960 Any other non-nil value -- the selected frame;
2946 nil -- do not search any frames (equivalent to omitting the entry). 2961 nil -- do not search any frames (equivalent to omitting the entry).