aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorMartin Rudalics2019-05-19 11:03:05 +0200
committerMartin Rudalics2019-05-19 11:03:05 +0200
commit8783becbba410581c6384ee021e7e83ad5236a29 (patch)
tree96cb1f85d83a836f9823acac0e16a89b7a0d9769 /doc/lispref
parentb87e5eea1dd7c7345d0a9f82759eedfd7c9a8099 (diff)
downloademacs-8783becbba410581c6384ee021e7e83ad5236a29.tar.gz
emacs-8783becbba410581c6384ee021e7e83ad5236a29.zip
New buffer display action function 'display-buffer-in-direction'
* lisp/window.el (windows-sharing-edge) (window--try-to-split-window-in-direction) (display-buffer-in-direction): New functions. * doc/lispref/windows.texi (Buffer Display Action Functions): Describe new action function 'display-buffer-in-direction'. (Buffer Display Action Alists): Describe new entry 'direction'. Amend description of 'window' entry. * etc/NEWS: Mention 'display-buffer-in-direction' and 'direction' and 'window' action alist entries.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/windows.texi67
1 files changed, 66 insertions, 1 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 32e8c2afa31..96e42a148c5 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2601,6 +2601,63 @@ window and displaying the buffer in that window. It can fail if all
2601windows are dedicated to other buffers (@pxref{Dedicated Windows}). 2601windows are dedicated to other buffers (@pxref{Dedicated Windows}).
2602@end defun 2602@end defun
2603 2603
2604@defun display-buffer-in-direction buffer alist
2605This function tries to display @var{buffer} at a location specified by
2606@var{alist}. For this purpose, @var{alist} should contain a
2607@code{direction} entry whose value is one of @code{left}, @code{above}
2608(or @code{up}), @code{right} and @code{below} (or @code{down}). Other
2609values are usually interpreted as @code{below}.
2610
2611If @var{alist} also contains a @code{window} entry, its value
2612specifies a reference window. That value can be a special symbol like
2613@code{main} which stands for the selected frame's main window
2614(@pxref{Side Window Options and Functions}) or @code{root} standing
2615for the selected frame's root window (@pxref{Windows and Frames}). It
2616can also specify an arbitrary valid window. Any other value (or
2617omitting the @code{window} entry entirely) means to use the selected
2618window as reference window.
2619
2620This function first tries to reuse a window in the specified direction
2621that already shows @var{buffer}. If no such window exists, it tries
2622to split the reference window in order to produce a new window in the
2623specified direction. If this fails as well, it will try to display
2624@var{buffer} in an existing window in the specified direction. In
2625either case, the window chosen will appear on the side of the
2626reference window specified by the @code{direction} entry, sharing at
2627least one edge with the reference window.
2628
2629If the reference window is live, the edge the chosen window will share
2630with it is always the opposite of the one specified by the
2631@code{direction} entry. For example, if the value of the
2632@code{direction} entry is @code{left}, the chosen window's right edge
2633coordinate (@pxref{Coordinates and Windows}) will equal the reference
2634window's left edge coordinate.
2635
2636If the reference window is internal, a reused window must share with
2637it the edge specified by the @code{direction} entry. Hence if, for
2638example, the reference window is the frame's root window and the value
2639of the @code{direction} entry is @code{left}, a reused window must be
2640on the left of the frame. This means that the left edge coordinate of
2641the chosen window and that of the reference window are the same.
2642
2643A new window, however, will be created by splitting the reference
2644window such that the chosen window will share the opposite edge with
2645the reference window. In our example, a new root window would be
2646created with a new live window and the reference window as its
2647children. The chosen window's right edge coordinate would then equal
2648the left edge coordinate of the reference window. Its left edge
2649coordinate would equal the left edge coordinate of the frame's new
2650root window.
2651
2652Four special values for @code{direction} entries allow to implicitly
2653specify the selected frame's main window as the reference window:
2654@code{leftmost}, @code{top}, @code{rightmost} and @code{bottom}. This
2655means that instead of, for example, @w{@code{(direction . left)
2656(window . main)}} one can just specify @w{@code{(direction
2657. leftmost)}}. An existing @code{window} @var{alist} entry is ignored
2658in such cases.
2659@end defun
2660
2604@defun display-buffer-below-selected buffer alist 2661@defun display-buffer-below-selected buffer alist
2605This function tries to display @var{buffer} in a window below the 2662This function tries to display @var{buffer} in a window below the
2606selected window. If there is a window below the selected one and that 2663selected window. If there is a window below the selected one and that
@@ -2934,12 +2991,20 @@ If non-@code{nil}, the value specifies the slot of the side window
2934supposed to display the buffer. This entry is used only by 2991supposed to display the buffer. This entry is used only by
2935@code{display-buffer-in-side-window}. 2992@code{display-buffer-in-side-window}.
2936 2993
2994@vindex direction@r{, a buffer display action alist entry}
2995@item direction
2996The value specifies a direction which, together with a @code{window}
2997entry, allows @code{display-buffer-in-direction} to determine the
2998location of the window to display the buffer.
2999
2937@vindex window@r{, a buffer display action alist entry} 3000@vindex window@r{, a buffer display action alist entry}
2938@item window 3001@item window
2939The value specifies a window that is in some way related to the window 3002The value specifies a window that is in some way related to the window
2940chosen by @code{display-buffer}. This entry is currently used by 3003chosen by @code{display-buffer}. This entry is currently used by
2941@code{display-buffer-in-atom-window} to indicate the window on whose 3004@code{display-buffer-in-atom-window} to indicate the window on whose
2942side the new window shall be created. 3005side the new window shall be created. It is also used by
3006@code{display-buffer-in-direction} to specify the reference window on
3007whose side the resulting window shall appear.
2943 3008
2944@vindex allow-no-window@r{, a buffer display action alist entry} 3009@vindex allow-no-window@r{, a buffer display action alist entry}
2945@item allow-no-window 3010@item allow-no-window