diff options
| author | Martin Rudalics | 2019-05-19 11:03:05 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2019-05-19 11:03:05 +0200 |
| commit | 8783becbba410581c6384ee021e7e83ad5236a29 (patch) | |
| tree | 96cb1f85d83a836f9823acac0e16a89b7a0d9769 /doc/lispref | |
| parent | b87e5eea1dd7c7345d0a9f82759eedfd7c9a8099 (diff) | |
| download | emacs-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.texi | 67 |
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 | |||
| 2601 | windows are dedicated to other buffers (@pxref{Dedicated Windows}). | 2601 | windows are dedicated to other buffers (@pxref{Dedicated Windows}). |
| 2602 | @end defun | 2602 | @end defun |
| 2603 | 2603 | ||
| 2604 | @defun display-buffer-in-direction buffer alist | ||
| 2605 | This 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 | ||
| 2609 | values are usually interpreted as @code{below}. | ||
| 2610 | |||
| 2611 | If @var{alist} also contains a @code{window} entry, its value | ||
| 2612 | specifies 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 | ||
| 2615 | for the selected frame's root window (@pxref{Windows and Frames}). It | ||
| 2616 | can also specify an arbitrary valid window. Any other value (or | ||
| 2617 | omitting the @code{window} entry entirely) means to use the selected | ||
| 2618 | window as reference window. | ||
| 2619 | |||
| 2620 | This function first tries to reuse a window in the specified direction | ||
| 2621 | that already shows @var{buffer}. If no such window exists, it tries | ||
| 2622 | to split the reference window in order to produce a new window in the | ||
| 2623 | specified direction. If this fails as well, it will try to display | ||
| 2624 | @var{buffer} in an existing window in the specified direction. In | ||
| 2625 | either case, the window chosen will appear on the side of the | ||
| 2626 | reference window specified by the @code{direction} entry, sharing at | ||
| 2627 | least one edge with the reference window. | ||
| 2628 | |||
| 2629 | If the reference window is live, the edge the chosen window will share | ||
| 2630 | with 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 | ||
| 2633 | coordinate (@pxref{Coordinates and Windows}) will equal the reference | ||
| 2634 | window's left edge coordinate. | ||
| 2635 | |||
| 2636 | If the reference window is internal, a reused window must share with | ||
| 2637 | it the edge specified by the @code{direction} entry. Hence if, for | ||
| 2638 | example, the reference window is the frame's root window and the value | ||
| 2639 | of the @code{direction} entry is @code{left}, a reused window must be | ||
| 2640 | on the left of the frame. This means that the left edge coordinate of | ||
| 2641 | the chosen window and that of the reference window are the same. | ||
| 2642 | |||
| 2643 | A new window, however, will be created by splitting the reference | ||
| 2644 | window such that the chosen window will share the opposite edge with | ||
| 2645 | the reference window. In our example, a new root window would be | ||
| 2646 | created with a new live window and the reference window as its | ||
| 2647 | children. The chosen window's right edge coordinate would then equal | ||
| 2648 | the left edge coordinate of the reference window. Its left edge | ||
| 2649 | coordinate would equal the left edge coordinate of the frame's new | ||
| 2650 | root window. | ||
| 2651 | |||
| 2652 | Four special values for @code{direction} entries allow to implicitly | ||
| 2653 | specify the selected frame's main window as the reference window: | ||
| 2654 | @code{leftmost}, @code{top}, @code{rightmost} and @code{bottom}. This | ||
| 2655 | means 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 | ||
| 2658 | in such cases. | ||
| 2659 | @end defun | ||
| 2660 | |||
| 2604 | @defun display-buffer-below-selected buffer alist | 2661 | @defun display-buffer-below-selected buffer alist |
| 2605 | This function tries to display @var{buffer} in a window below the | 2662 | This function tries to display @var{buffer} in a window below the |
| 2606 | selected window. If there is a window below the selected one and that | 2663 | selected 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 | |||
| 2934 | supposed to display the buffer. This entry is used only by | 2991 | supposed 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 | ||
| 2996 | The value specifies a direction which, together with a @code{window} | ||
| 2997 | entry, allows @code{display-buffer-in-direction} to determine the | ||
| 2998 | location 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 |
| 2939 | The value specifies a window that is in some way related to the window | 3002 | The value specifies a window that is in some way related to the window |
| 2940 | chosen by @code{display-buffer}. This entry is currently used by | 3003 | chosen 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 |
| 2942 | side the new window shall be created. | 3005 | side the new window shall be created. It is also used by |
| 3006 | @code{display-buffer-in-direction} to specify the reference window on | ||
| 3007 | whose 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 |