diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 8 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 108 |
2 files changed, 102 insertions, 14 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 89b456f5c22..062692ee9f3 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-11-16 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * windows.texi (Choosing Window): Rewrite description of | ||
| 4 | display-buffer-alist (Bug#12167). | ||
| 5 | (Display Action Functions): Mention inhibit-switch-frame. Fix | ||
| 6 | description of display-buffer-below-selected. Reorder actions. | ||
| 7 | Add example (Bug#12848). | ||
| 8 | |||
| 1 | 2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * keymaps.texi (Translation Keymaps): Add a subsection "Interaction | 11 | * keymaps.texi (Translation Keymaps): Add a subsection "Interaction |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index bb02b1d54fd..77f1ff9a179 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -1766,6 +1766,7 @@ Like @code{switch-to-buffer}, this function updates the buffer list | |||
| 1766 | unless @var{norecord} is non-@code{nil}. | 1766 | unless @var{norecord} is non-@code{nil}. |
| 1767 | @end deffn | 1767 | @end deffn |
| 1768 | 1768 | ||
| 1769 | |||
| 1769 | @node Choosing Window | 1770 | @node Choosing Window |
| 1770 | @section Choosing a Window for Display | 1771 | @section Choosing a Window for Display |
| 1771 | 1772 | ||
| @@ -1851,10 +1852,14 @@ default value is empty, i.e. @code{(nil . nil)}. | |||
| 1851 | @end defvar | 1852 | @end defvar |
| 1852 | 1853 | ||
| 1853 | @defopt display-buffer-alist | 1854 | @defopt display-buffer-alist |
| 1854 | The value of this option is an alist mapping regular expressions to | 1855 | The value of this option is an alist mapping conditions to display |
| 1855 | display actions. If the name of the buffer passed to | 1856 | actions. Each condition may be either a regular expression matching a |
| 1856 | @code{display-buffer} matches a regular expression in this alist, then | 1857 | buffer name or a function that takes two arguments - a buffer name and |
| 1857 | @code{display-buffer} uses the corresponding display action. | 1858 | the @var{action} argument passed to @code{display-buffer}. If the name |
| 1859 | of the buffer passed to @code{display-buffer} either matches a regular | ||
| 1860 | expression in this alist or the function specified by a condition | ||
| 1861 | returns non-@code{nil}, then @code{display-buffer} uses the | ||
| 1862 | corresponding display action to display the buffer. | ||
| 1858 | @end defopt | 1863 | @end defopt |
| 1859 | 1864 | ||
| 1860 | @defopt display-buffer-base-action | 1865 | @defopt display-buffer-base-action |
| @@ -1868,6 +1873,7 @@ This display action specifies the fallback behavior for | |||
| 1868 | @code{display-buffer} if no other display actions are given. | 1873 | @code{display-buffer} if no other display actions are given. |
| 1869 | @end defvr | 1874 | @end defvr |
| 1870 | 1875 | ||
| 1876 | |||
| 1871 | @node Display Action Functions | 1877 | @node Display Action Functions |
| 1872 | @section Action Functions for @code{display-buffer} | 1878 | @section Action Functions for @code{display-buffer} |
| 1873 | 1879 | ||
| @@ -1911,8 +1917,9 @@ normally searches just the selected frame; however, if the variable | |||
| 1911 | @code{pop-up-frames} is non-@code{nil}, it searches all frames on the | 1917 | @code{pop-up-frames} is non-@code{nil}, it searches all frames on the |
| 1912 | current terminal. @xref{Choosing Window Options}. | 1918 | current terminal. @xref{Choosing Window Options}. |
| 1913 | 1919 | ||
| 1914 | If this function chooses a window on another frame, it makes that | 1920 | If this function chooses a window on another frame, it makes that frame |
| 1915 | frame visible and raises it if necessary. | 1921 | visible and, unless @var{alist} contains an @code{inhibit-switch-frame} |
| 1922 | entry (@pxref{Choosing Window Options}), raises that frame if necessary. | ||
| 1916 | @end defun | 1923 | @end defun |
| 1917 | 1924 | ||
| 1918 | @defun display-buffer-pop-up-frame buffer alist | 1925 | @defun display-buffer-pop-up-frame buffer alist |
| @@ -1976,16 +1983,12 @@ reason (e.g. if there is just one frame and it has an | |||
| 1976 | @code{unsplittable} frame parameter; @pxref{Buffer Parameters}). | 1983 | @code{unsplittable} frame parameter; @pxref{Buffer Parameters}). |
| 1977 | @end defun | 1984 | @end defun |
| 1978 | 1985 | ||
| 1979 | @defun display-buffer-use-some-window buffer alist | ||
| 1980 | This function tries to display @var{buffer} by choosing an existing | ||
| 1981 | window and displaying the buffer in that window. It can fail if all | ||
| 1982 | windows are dedicated to another buffer (@pxref{Dedicated Windows}). | ||
| 1983 | @end defun | ||
| 1984 | |||
| 1985 | @defun display-buffer-below-selected buffer alist | 1986 | @defun display-buffer-below-selected buffer alist |
| 1986 | This function tries to display @var{buffer} in a window below the | 1987 | This function tries to display @var{buffer} in a window below the |
| 1987 | selected window. This means to either split the selected window or | 1988 | selected window. This means to either split the selected window or use |
| 1988 | reuse the window below the selected one. | 1989 | the window below the selected one. If it does create a new window, it |
| 1990 | will also adjust its size provided @var{alist} contains a suitable | ||
| 1991 | @code{window-height} or @code{window-width} entry, see above. | ||
| 1989 | @end defun | 1992 | @end defun |
| 1990 | 1993 | ||
| 1991 | @defun display-buffer-in-previous-window buffer alist | 1994 | @defun display-buffer-in-previous-window buffer alist |
| @@ -2001,6 +2004,83 @@ specified by that entry will override any other window found by the | |||
| 2001 | methods above, even if that window never showed @var{buffer} before. | 2004 | methods above, even if that window never showed @var{buffer} before. |
| 2002 | @end defun | 2005 | @end defun |
| 2003 | 2006 | ||
| 2007 | @defun display-buffer-use-some-window buffer alist | ||
| 2008 | This function tries to display @var{buffer} by choosing an existing | ||
| 2009 | window and displaying the buffer in that window. It can fail if all | ||
| 2010 | windows are dedicated to another buffer (@pxref{Dedicated Windows}). | ||
| 2011 | @end defun | ||
| 2012 | |||
| 2013 | To illustrate the use of action functions, consider the following | ||
| 2014 | example. | ||
| 2015 | |||
| 2016 | @example | ||
| 2017 | @group | ||
| 2018 | (display-buffer | ||
| 2019 | (get-buffer-create "*foo*") | ||
| 2020 | '((display-buffer-reuse-window | ||
| 2021 | display-buffer-pop-up-window | ||
| 2022 | display-buffer-pop-up-frame) | ||
| 2023 | (reusable-frames . 0) | ||
| 2024 | (window-height . 10) (window-width . 40))) | ||
| 2025 | @end group | ||
| 2026 | @end example | ||
| 2027 | |||
| 2028 | @noindent | ||
| 2029 | Evaluating the form above will cause @code{display-buffer} to proceed as | ||
| 2030 | follows: If `*foo*' already appears on a visible or iconified frame, it | ||
| 2031 | will reuse its window. Otherwise, it will try to pop up a new window | ||
| 2032 | or, if that is impossible, a new frame. If all these steps fail, it | ||
| 2033 | will try to use some existing window. | ||
| 2034 | |||
| 2035 | Furthermore, @code{display-buffer} will try to adjust a reused window | ||
| 2036 | (provided `*foo*' was put by @code{display-buffer} there before) or a | ||
| 2037 | popped-up window as follows: If the window is part of a vertical | ||
| 2038 | combination, it will set its height to ten lines. Note that if, instead | ||
| 2039 | of the number ``10'', we specified the function | ||
| 2040 | @code{fit-window-to-buffer}, @code{display-buffer} would come up with a | ||
| 2041 | one-line window to fit the empty buffer. If the window is part of a | ||
| 2042 | horizontal combination, it sets its width to 40 columns. Whether a new | ||
| 2043 | window is vertically or horizontally combined depends on the shape of | ||
| 2044 | the window split and the values of | ||
| 2045 | @code{split-window-preferred-function}, @code{split-height-threshold} | ||
| 2046 | and @code{split-width-threshold} (@pxref{Choosing Window Options}). | ||
| 2047 | |||
| 2048 | Now suppose we combine this call with a preexisting setup for | ||
| 2049 | `display-buffer-alist' as follows. | ||
| 2050 | |||
| 2051 | @example | ||
| 2052 | @group | ||
| 2053 | (let ((display-buffer-alist | ||
| 2054 | (cons | ||
| 2055 | '("\\*foo\\*" | ||
| 2056 | (display-buffer-reuse-window display-buffer-below-selected) | ||
| 2057 | (reusable-frames) | ||
| 2058 | (window-height . 5)) | ||
| 2059 | display-buffer-alist))) | ||
| 2060 | (display-buffer | ||
| 2061 | (get-buffer-create "*foo*") | ||
| 2062 | '((display-buffer-reuse-window | ||
| 2063 | display-buffer-pop-up-window | ||
| 2064 | display-buffer-pop-up-frame) | ||
| 2065 | (reusable-frames . 0) | ||
| 2066 | (window-height . 10) (window-width . 40)))) | ||
| 2067 | @end group | ||
| 2068 | @end example | ||
| 2069 | |||
| 2070 | @noindent | ||
| 2071 | Evaluating this form will cause @code{display-buffer} to first try | ||
| 2072 | reusing a window showing @code{*foo*} on the selected frame. | ||
| 2073 | If no such window exists, it will try to split the selected window or, | ||
| 2074 | if that is impossible, use the window below the selected window. | ||
| 2075 | |||
| 2076 | If there's no window below the selected one, or the window below the | ||
| 2077 | selected one is dedicated to its buffer, @code{display-buffer} will | ||
| 2078 | proceed as described in the previous example. Note, however, that when | ||
| 2079 | it tries to adjust the height of any reused or popped-up window, it will | ||
| 2080 | in any case try to set its number of lines to ``5'' since that value | ||
| 2081 | overrides the corresponding specification in the @var{action} argument | ||
| 2082 | of @code{display-buffer}. | ||
| 2083 | |||
| 2004 | 2084 | ||
| 2005 | @node Choosing Window Options | 2085 | @node Choosing Window Options |
| 2006 | @section Additional Options for Displaying Buffers | 2086 | @section Additional Options for Displaying Buffers |