diff options
| author | Martin Rudalics | 2018-11-08 20:20:13 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2018-11-08 20:20:13 +0100 |
| commit | fa605f242eec680b2c7d1374d1405510818d9103 (patch) | |
| tree | 651552b9fdaa85a52f5704ed32d1df60967ee885 | |
| parent | aa556596fabe07af8ee33f59c6d3ec3b882f369e (diff) | |
| download | emacs-fa605f242eec680b2c7d1374d1405510818d9103.tar.gz emacs-fa605f242eec680b2c7d1374d1405510818d9103.zip | |
Rewrite buffer display related doc-strings and doc
* lisp/window.el (display-buffer-overriding-action)
(display-buffer-alist, display-buffer-base-action)
(display-buffer-fallback-action, display-buffer-assq-regexp)
(display-buffer): Rewrite doc-strings using suggestions by
Alan Mackenzie <acm@muc.de>.
(display-buffer-use-some-frame): Adjust doc-string and
reformat code.
* doc/lispref/windows.texi (Buffer Display Action Alists):
Make docs on 'window-height', 'window-width' and
'preserve-size' entries more accurate.
| -rw-r--r-- | doc/lispref/windows.texi | 58 | ||||
| -rw-r--r-- | lisp/window.el | 286 |
2 files changed, 195 insertions, 149 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 640c9923e99..106074e13d1 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -2747,8 +2747,8 @@ the buffer. This entry is used by | |||
| 2747 | 2747 | ||
| 2748 | @vindex reusable-frames@r{, a buffer display action alist entry} | 2748 | @vindex reusable-frames@r{, a buffer display action alist entry} |
| 2749 | @item reusable-frames | 2749 | @item reusable-frames |
| 2750 | The value specifies the frame(s) to search for a window that can be | 2750 | The value specifies the set of frames to search for a window that can |
| 2751 | reused because it already displays the buffer. It can be set as | 2751 | be reused because it already displays the buffer. It can be set as |
| 2752 | follows: | 2752 | follows: |
| 2753 | 2753 | ||
| 2754 | @itemize @bullet | 2754 | @itemize @bullet |
| @@ -2792,17 +2792,20 @@ entry. | |||
| 2792 | @vindex window-height@r{, a buffer display action alist entry} | 2792 | @vindex window-height@r{, a buffer display action alist entry} |
| 2793 | @item window-height | 2793 | @item window-height |
| 2794 | The value specifies whether and how to adjust the height of the chosen | 2794 | The value specifies whether and how to adjust the height of the chosen |
| 2795 | window, and can have the following values: | 2795 | window and can be one of the following: |
| 2796 | 2796 | ||
| 2797 | @itemize @bullet | 2797 | @itemize @bullet |
| 2798 | @item | 2798 | @item |
| 2799 | @code{nil} means to leave the height of the chosen window alone. | 2799 | @code{nil} means to leave the height of the chosen window alone. |
| 2800 | 2800 | ||
| 2801 | @item | 2801 | @item |
| 2802 | A number specifies the desired height of the chosen window. An | 2802 | An integer number specifies the desired total height of the chosen |
| 2803 | integer specifies the number of lines of the window. A floating-point | 2803 | window in lines. |
| 2804 | number gives the fraction of the window's height with respect to the | 2804 | |
| 2805 | height of the frame's root window. | 2805 | @item |
| 2806 | A floating-point number specifies the fraction of the chosen window's | ||
| 2807 | desired total height with respect to the total height of its frame's | ||
| 2808 | root window. | ||
| 2806 | 2809 | ||
| 2807 | @item | 2810 | @item |
| 2808 | If the value specifies a function, that function is called with one | 2811 | If the value specifies a function, that function is called with one |
| @@ -2812,7 +2815,11 @@ are @code{shrink-window-if-larger-than-buffer} and | |||
| 2812 | @code{fit-window-to-buffer}, see @ref{Resizing Windows}. | 2815 | @code{fit-window-to-buffer}, see @ref{Resizing Windows}. |
| 2813 | @end itemize | 2816 | @end itemize |
| 2814 | 2817 | ||
| 2815 | All action functions that choose a window should process this entry. | 2818 | By convention, the height of the chosen window is adjusted only if the |
| 2819 | window is part of a vertical combination (@pxref{Windows and Frames}) | ||
| 2820 | to avoid changing the height of other, unrelated windows. Also, this | ||
| 2821 | entry should be processed only under certain conditions which are | ||
| 2822 | specified right below this list. | ||
| 2816 | 2823 | ||
| 2817 | @vindex window-width@r{, a buffer display action alist entry} | 2824 | @vindex window-width@r{, a buffer display action alist entry} |
| 2818 | @item window-width | 2825 | @item window-width |
| @@ -2825,10 +2832,13 @@ value can be one of the following: | |||
| 2825 | @code{nil} means to leave the width of the chosen window alone. | 2832 | @code{nil} means to leave the width of the chosen window alone. |
| 2826 | 2833 | ||
| 2827 | @item | 2834 | @item |
| 2828 | A number specifies the desired width of the chosen window. An integer | 2835 | An integer specifies the desired total width of the chosen window in |
| 2829 | specifies the number of columns of the window. A floating-point | 2836 | columns. |
| 2830 | number gives the fraction of the window's width with respect to the | 2837 | |
| 2831 | width of the frame's root window. | 2838 | @item |
| 2839 | A floating-point number specifies the fraction of the chosen window's | ||
| 2840 | desired total width with respect to the total width of the frame's | ||
| 2841 | root window. | ||
| 2832 | 2842 | ||
| 2833 | @item | 2843 | @item |
| 2834 | If the value specifies a function, that function is called with one | 2844 | If the value specifies a function, that function is called with one |
| @@ -2836,16 +2846,21 @@ argument---the chosen window. The function is supposed to adjust the | |||
| 2836 | width of the window; its return value is ignored. | 2846 | width of the window; its return value is ignored. |
| 2837 | @end itemize | 2847 | @end itemize |
| 2838 | 2848 | ||
| 2839 | All action functions that choose a window should process this entry. | 2849 | By convention, the width of the chosen window is adjusted only if the |
| 2850 | window is part of a horizontal combination (@pxref{Windows and | ||
| 2851 | Frames}) to avoid changing the width of other, unrelated windows. | ||
| 2852 | Also, this entry should be processed under only certain conditions | ||
| 2853 | which are specified right below this list. | ||
| 2840 | 2854 | ||
| 2841 | @vindex preserve-size@r{, a buffer display action alist entry} | 2855 | @vindex preserve-size@r{, a buffer display action alist entry} |
| 2842 | @item preserve-size | 2856 | @item preserve-size |
| 2843 | If non-@code{nil} such an entry tells Emacs to preserve the size of | 2857 | If non-@code{nil} such an entry tells Emacs to preserve the size of |
| 2844 | the window chosen (@pxref{Preserving Window Sizes}). The value should | 2858 | the window chosen (@pxref{Preserving Window Sizes}). The value should |
| 2845 | be either @code{(t . nil)} to preserve the width of the window, | 2859 | be either @w{@code{(t . nil)}} to preserve the width of the window, |
| 2846 | @code{(nil . t)} to preserve its height or @code{(t . t)} to preserve | 2860 | @w{@code{(nil . t)}} to preserve its height or @w{@code{(t . t)}} to |
| 2847 | both its width and its height. All action functions that choose a | 2861 | preserve both, its width and its height. This entry should be |
| 2848 | window should process this entry. | 2862 | processed only under certain conditions which are specified right |
| 2863 | after this list. | ||
| 2849 | 2864 | ||
| 2850 | @vindex pop-up-frame-parameters@r{, a buffer display action alist entry} | 2865 | @vindex pop-up-frame-parameters@r{, a buffer display action alist entry} |
| 2851 | @item pop-up-frame-parameters | 2866 | @item pop-up-frame-parameters |
| @@ -2900,6 +2915,15 @@ will display the buffer. @code{display-buffer-no-window} is the only | |||
| 2900 | action function that cares about this entry. | 2915 | action function that cares about this entry. |
| 2901 | @end table | 2916 | @end table |
| 2902 | 2917 | ||
| 2918 | By convention, the entries @code{window-height}, @code{window-width} | ||
| 2919 | and @code{preserve-size} are applied after the chosen window's buffer | ||
| 2920 | has been set up and if and only if that window never showed another | ||
| 2921 | buffer before. More precisely, the latter means that the window must | ||
| 2922 | have been either created by the current @code{display-buffer} call or | ||
| 2923 | the window was created earlier by @code{display-buffer} to show the | ||
| 2924 | buffer and never was used to show another buffer until it was reused | ||
| 2925 | by the current invocation of @code{display-buffer}. | ||
| 2926 | |||
| 2903 | 2927 | ||
| 2904 | @node Choosing Window Options | 2928 | @node Choosing Window Options |
| 2905 | @subsection Additional Options for Displaying Buffers | 2929 | @subsection Additional Options for Displaying Buffers |
diff --git a/lisp/window.el b/lisp/window.el index f96c887be48..92cd8c27380 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -6705,7 +6705,11 @@ live." | |||
| 6705 | ((or (eq type 'frame) | 6705 | ((or (eq type 'frame) |
| 6706 | (and (eq (car quit-restore) 'same) | 6706 | (and (eq (car quit-restore) 'same) |
| 6707 | (eq (nth 1 quit-restore) 'frame))) | 6707 | (eq (nth 1 quit-restore) 'frame))) |
| 6708 | ;; Adjust size of frame if asked for. | 6708 | ;; A window that never showed another buffer but BUFFER ever |
| 6709 | ;; since it was created on a new frame. | ||
| 6710 | ;; | ||
| 6711 | ;; Adjust size of frame if asked for. We probably should do | ||
| 6712 | ;; that only for a single window frame. | ||
| 6709 | (cond | 6713 | (cond |
| 6710 | ((not size)) | 6714 | ((not size)) |
| 6711 | ((consp size) | 6715 | ((consp size) |
| @@ -6724,7 +6728,10 @@ live." | |||
| 6724 | ((or (eq type 'window) | 6728 | ((or (eq type 'window) |
| 6725 | (and (eq (car quit-restore) 'same) | 6729 | (and (eq (car quit-restore) 'same) |
| 6726 | (eq (nth 1 quit-restore) 'window))) | 6730 | (eq (nth 1 quit-restore) 'window))) |
| 6727 | ;; Adjust height of window if asked for. | 6731 | ;; A window that never showed another buffer but BUFFER ever |
| 6732 | ;; since it was created on an existing frame. | ||
| 6733 | ;; | ||
| 6734 | ;; Adjust width and/or height of window if asked for. | ||
| 6728 | (cond | 6735 | (cond |
| 6729 | ((not height)) | 6736 | ((not height)) |
| 6730 | ((numberp height) | 6737 | ((numberp height) |
| @@ -6820,31 +6827,41 @@ The actual non-nil value of this variable will be copied to the | |||
| 6820 | "Custom type for `display-buffer' actions.") | 6827 | "Custom type for `display-buffer' actions.") |
| 6821 | 6828 | ||
| 6822 | (defvar display-buffer-overriding-action '(nil . nil) | 6829 | (defvar display-buffer-overriding-action '(nil . nil) |
| 6823 | "User-defined overriding action to perform to display a buffer. | 6830 | "Overriding action for buffer display. |
| 6824 | This action overrides all the other actions in the action variables | 6831 | This action overrides all the other actions in the action |
| 6825 | and arguments passed to `display-buffer'. | 6832 | variables and arguments passed to `display-buffer'. The value |
| 6826 | Value should be a cons cell (FUNCTION . ALIST), where FUNCTION is | 6833 | should be a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is a |
| 6827 | a function or a list of functions. Each function should accept | 6834 | function or a list of functions. Each function should accept two |
| 6828 | two arguments: a buffer to display and an alist similar to ALIST. | 6835 | arguments: a buffer to display and an alist similar to ALIST. |
| 6829 | The default value is empty. | 6836 | See `display-buffer' for details. |
| 6830 | See `display-buffer' for details.") | 6837 | |
| 6838 | This variable is not intended for user customization. Lisp | ||
| 6839 | programs should never set this variable permanently but may bind | ||
| 6840 | it around calls of buffer display functions like `display-buffer' | ||
| 6841 | or `pop-to-buffer'. Since such a binding will affect any nested | ||
| 6842 | buffer display requests, this variable should be used with utmost | ||
| 6843 | care.") | ||
| 6831 | (put 'display-buffer-overriding-action 'risky-local-variable t) | 6844 | (put 'display-buffer-overriding-action 'risky-local-variable t) |
| 6832 | 6845 | ||
| 6833 | (defcustom display-buffer-alist nil | 6846 | (defcustom display-buffer-alist nil |
| 6834 | "Alist of user-defined conditional actions for `display-buffer'. | 6847 | "Alist of user-defined conditional actions for `display-buffer'. |
| 6835 | Its value takes effect before `display-buffer-base-action' | 6848 | Its value takes effect before processing the ACTION argument of |
| 6836 | and `display-buffer-fallback-action', but after | 6849 | `display-buffer' and before `display-buffer-base-action' and |
| 6850 | `display-buffer-fallback-action', but after | ||
| 6837 | `display-buffer-overriding-action', which see. | 6851 | `display-buffer-overriding-action', which see. |
| 6838 | If non-nil, this is a list of elements (CONDITION . ACTION), where: | 6852 | |
| 6853 | If non-nil, this is an alist of elements (CONDITION . ACTION), | ||
| 6854 | where: | ||
| 6839 | 6855 | ||
| 6840 | CONDITION is either a regexp matching buffer names, or a | 6856 | CONDITION is either a regexp matching buffer names, or a |
| 6841 | function that takes two arguments - a buffer name and the | 6857 | function that takes two arguments - a buffer name and the |
| 6842 | ACTION argument of `display-buffer' - and returns a boolean. | 6858 | ACTION argument of `display-buffer' - and returns a boolean. |
| 6843 | 6859 | ||
| 6844 | ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a | 6860 | ACTION is a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is an |
| 6845 | function or a list of functions. Each such function should | 6861 | action function or a list of action functions and ALIST is an |
| 6846 | accept two arguments: a buffer to display and an alist of the | 6862 | action alist. Each such action function should accept two |
| 6847 | same form as ALIST. See `display-buffer' for details. | 6863 | arguments: a buffer to display and an alist of the same form as |
| 6864 | ALIST. See `display-buffer' for details. | ||
| 6848 | 6865 | ||
| 6849 | `display-buffer' scans this alist until it either finds a | 6866 | `display-buffer' scans this alist until it either finds a |
| 6850 | matching regular expression or the function specified by a | 6867 | matching regular expression or the function specified by a |
| @@ -6864,11 +6881,12 @@ associated action to the list of actions it will try." | |||
| 6864 | This is the default action used by `display-buffer' if no other | 6881 | This is the default action used by `display-buffer' if no other |
| 6865 | actions are specified or all fail, before falling back on | 6882 | actions are specified or all fail, before falling back on |
| 6866 | `display-buffer-fallback-action'. | 6883 | `display-buffer-fallback-action'. |
| 6867 | It should be a cons cell (FUNCTION . ALIST), where FUNCTION is a | 6884 | |
| 6868 | function or a list of functions. Each function should accept two | 6885 | It should be a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is |
| 6869 | arguments: a buffer to display and an alist similar to ALIST. | 6886 | an action function or a list of action functions and ALIST is an |
| 6870 | The default value is empty. | 6887 | action alist. Each such action function should accept two |
| 6871 | See `display-buffer' for details." | 6888 | arguments: a buffer to display and an alist of the same form as |
| 6889 | ALIST. See `display-buffer' for details." | ||
| 6872 | :type display-buffer--action-custom-type | 6890 | :type display-buffer--action-custom-type |
| 6873 | :risky t | 6891 | :risky t |
| 6874 | :version "24.1" | 6892 | :version "24.1" |
| @@ -6884,17 +6902,20 @@ See `display-buffer' for details." | |||
| 6884 | display-buffer-pop-up-frame)) | 6902 | display-buffer-pop-up-frame)) |
| 6885 | "Default fallback action for `display-buffer'. | 6903 | "Default fallback action for `display-buffer'. |
| 6886 | This is the action used by `display-buffer' if no other actions | 6904 | This is the action used by `display-buffer' if no other actions |
| 6887 | specified, e.g. by the user options `display-buffer-alist' or | 6905 | have been specified, for example, by the user options |
| 6888 | `display-buffer-base-action', or they all fail. See `display-buffer'.") | 6906 | `display-buffer-alist' or `display-buffer-base-action', or they |
| 6907 | all fail. It should never be set by programs or users. See | ||
| 6908 | `display-buffer'.") | ||
| 6889 | (put 'display-buffer-fallback-action 'risky-local-variable t) | 6909 | (put 'display-buffer-fallback-action 'risky-local-variable t) |
| 6890 | 6910 | ||
| 6891 | (defun display-buffer-assq-regexp (buffer-name alist action) | 6911 | (defun display-buffer-assq-regexp (buffer-name alist action) |
| 6892 | "Retrieve ALIST entry corresponding to BUFFER-NAME. | 6912 | "Retrieve ALIST entry corresponding to BUFFER-NAME. |
| 6893 | This returns the cdr of the ALIST entry if either its key is a | 6913 | This returns the cdr of the alist entry ALIST if either its key |
| 6894 | string that matches BUFFER-NAME, as reported by `string-match-p'; | 6914 | is a string that matches BUFFER-NAME, as reported by |
| 6895 | or if the key is a function that returns a non-nil when called | 6915 | `string-match-p'; or if the key is a function that returns |
| 6896 | with 3 arguments: the ALIST key, BUFFER-NAME, and ACTION. | 6916 | non-nil when called with three arguments: the ALIST key, |
| 6897 | ACTION should have the form of the action argument passed to `display-buffer'." | 6917 | BUFFER-NAME and ACTION. ACTION should have the form of the |
| 6918 | action argument passed to `display-buffer'." | ||
| 6898 | (catch 'match | 6919 | (catch 'match |
| 6899 | (dolist (entry alist) | 6920 | (dolist (entry alist) |
| 6900 | (let ((key (car entry))) | 6921 | (let ((key (car entry))) |
| @@ -6923,100 +6944,99 @@ fails, call `display-buffer-pop-up-frame'.") | |||
| 6923 | 6944 | ||
| 6924 | (defun display-buffer (buffer-or-name &optional action frame) | 6945 | (defun display-buffer (buffer-or-name &optional action frame) |
| 6925 | "Display BUFFER-OR-NAME in some window, without selecting it. | 6946 | "Display BUFFER-OR-NAME in some window, without selecting it. |
| 6926 | BUFFER-OR-NAME must be a buffer or the name of an existing | 6947 | BUFFER-OR-NAME must be a buffer or a string naming a live buffer. |
| 6927 | buffer. Return the window chosen for displaying BUFFER-OR-NAME, | 6948 | Return the window chosen for displaying that buffer, or nil if no |
| 6928 | or nil if no such window is found. | 6949 | such window is found. |
| 6929 | 6950 | ||
| 6930 | Optional argument ACTION, if non-nil, should specify a display | 6951 | Optional argument ACTION, if non-nil, should specify a buffer |
| 6931 | action. Its form is described below. | 6952 | display action of the form (FUNCTIONS . ALIST). FUNCTIONS is |
| 6932 | 6953 | either an \"action function\" or a possibly empty list of action | |
| 6933 | Optional argument FRAME, if non-nil, acts like an additional | 6954 | functions. ALIST is a possibly empty \"action alist\". |
| 6934 | ALIST entry (reusable-frames . FRAME) to the action list of ACTION, | 6955 | |
| 6935 | specifying the frame(s) to search for a window that is already | 6956 | An action function is a function that accepts two arguments: the |
| 6936 | displaying the buffer. See `display-buffer-reuse-window'. | 6957 | buffer to display and an action alist. Based on those arguments, |
| 6937 | 6958 | it should try to display the buffer in a window and return that | |
| 6938 | If ACTION is non-nil, it should have the form (FUNCTION . ALIST), | 6959 | window. An action alist is an association list mapping symbols |
| 6939 | where FUNCTION is either a function or a list of functions, and | 6960 | to values. Action functions use the action alist passed to them |
| 6940 | ALIST is an arbitrary association list (alist). | 6961 | to fine-tune their behaviors. |
| 6941 | 6962 | ||
| 6942 | Each such function should accept two arguments: the buffer to | 6963 | `display-buffer' builds a list of action functions and an action |
| 6943 | display and an alist. Based on those arguments, it should | 6964 | alist by combining any action functions and alists specified by |
| 6944 | display the buffer and return the window. If the caller is | ||
| 6945 | prepared to handle the case of not displaying the buffer | ||
| 6946 | and returning nil from `display-buffer' it should pass | ||
| 6947 | \(allow-no-window . t) as an element of the ALIST. | ||
| 6948 | |||
| 6949 | The `display-buffer' function builds a function list and an alist | ||
| 6950 | by combining the functions and alists specified in | ||
| 6951 | `display-buffer-overriding-action', `display-buffer-alist', the | 6965 | `display-buffer-overriding-action', `display-buffer-alist', the |
| 6952 | ACTION argument, `display-buffer-base-action', and | 6966 | ACTION argument, `display-buffer-base-action', and |
| 6953 | `display-buffer-fallback-action' (in order). Then it calls each | 6967 | `display-buffer-fallback-action' (in order). Then it calls each |
| 6954 | function in the combined function list in turn, passing the | 6968 | function in the combined function list in turn, passing the |
| 6955 | buffer as the first argument and the combined alist as the second | 6969 | buffer as the first argument and the combined action alist as the |
| 6956 | argument, until one of the functions returns non-nil. | 6970 | second argument, until one of the functions returns non-nil. |
| 6957 | 6971 | ||
| 6958 | If ACTION is nil, the function list and the alist are built using | 6972 | Action functions and the action they try to perform are: |
| 6959 | only the other variables mentioned above. | 6973 | `display-buffer-same-window' -- Use the selected window. |
| 6960 | 6974 | `display-buffer-reuse-window' -- Use a window already showing | |
| 6961 | Available action functions include: | 6975 | the buffer. |
| 6962 | `display-buffer-same-window' | 6976 | `display-buffer-in-previous-window' -- Use a window that did |
| 6963 | `display-buffer-reuse-window' | 6977 | show the buffer before. |
| 6964 | `display-buffer-pop-up-frame' | 6978 | `display-buffer-use-some-window' -- Use some existing window. |
| 6965 | `display-buffer-in-child-frame' | 6979 | `display-buffer-pop-up-window' -- Pop up a new window. |
| 6966 | `display-buffer-pop-up-window' | 6980 | `display-buffer-below-selected' -- Use or pop up a window below |
| 6967 | `display-buffer-in-previous-window' | 6981 | the selected one. |
| 6968 | `display-buffer-use-some-window' | 6982 | `display-buffer-at-bottom' -- Use or pop up a window at the |
| 6969 | `display-buffer-use-some-frame' | 6983 | bottom of the selected frame. |
| 6970 | 6984 | `display-buffer-pop-up-frame' -- Show the buffer on a new frame. | |
| 6971 | Recognized alist entries include: | 6985 | `display-buffer-in-child-frame' -- Show the buffer in a |
| 6972 | 6986 | child frame. | |
| 6973 | `inhibit-same-window' -- A non-nil value prevents the same | 6987 | `display-buffer-no-window' -- Do not display the buffer and |
| 6974 | window from being used for display. | 6988 | have `display-buffer' return nil immediately. |
| 6975 | 6989 | ||
| 6976 | `inhibit-switch-frame' -- A non-nil value prevents any other | 6990 | Action alist entries are: |
| 6977 | frame from being raised or selected, | 6991 | 'inhibit-same-window' -- A non-nil value prevents the same |
| 6978 | even if the window is displayed there. | 6992 | window from being used for display. |
| 6979 | 6993 | 'inhibit-switch-frame' -- A non-nil value prevents any frame | |
| 6980 | `reusable-frames' -- Value specifies frame(s) to search for a | 6994 | used for showing the buffer from being raised or selected. |
| 6981 | window that already displays the buffer. | 6995 | 'reusable-frames' -- The value specifies the set of frames to |
| 6982 | See `display-buffer-reuse-window'. | 6996 | search for a window that already displays the buffer. |
| 6983 | 6997 | Possible values are nil (the selected frame), t (any live | |
| 6984 | `pop-up-frame-parameters' -- Value specifies an alist of frame | 6998 | frame), visible (any visible frame), 0 (any visible or |
| 6985 | parameters to give a new frame, if | 6999 | iconified frame) or an existing live frame. |
| 6986 | one is created. | 7000 | 'pop-up-frame-parameters' -- The value specifies an alist of |
| 6987 | 7001 | frame parameters to give a new frame, if one is created. | |
| 6988 | `window-height' -- Value specifies either an integer (the number | 7002 | 'window-height' -- The value specifies the desired height of the |
| 6989 | of lines of a new window), a floating point number (the | 7003 | window chosen and is either an integer (the total height of |
| 6990 | fraction of a new window with respect to the height of the | 7004 | the window), a floating point number (the fraction of its |
| 6991 | frame's root window) or a function to be called with one | 7005 | total height with respect to the total height of the frame's |
| 6992 | argument - a new window. The function is supposed to adjust | 7006 | root window) or a function to be called with one argument - |
| 6993 | the height of the window; its return value is ignored. | 7007 | the chosen window. The function is supposed to adjust the |
| 6994 | Suitable functions are `shrink-window-if-larger-than-buffer' | 7008 | height of the window; its return value is ignored. Suitable |
| 6995 | and `fit-window-to-buffer'. | 7009 | functions are `shrink-window-if-larger-than-buffer' and |
| 6996 | 7010 | `fit-window-to-buffer'. | |
| 6997 | `window-width' -- Value specifies either an integer (the number | 7011 | 'window-width' -- The value specifies the desired width of the |
| 6998 | of columns of a new window), a floating point number (the | 7012 | window chosen and is either an integer (the total width of |
| 6999 | fraction of a new window with respect to the width of the | 7013 | the window), a floating point number (the fraction of its |
| 7000 | frame's root window) or a function to be called with one | 7014 | total width with respect to the width of the frame's root |
| 7001 | argument - a new window. The function is supposed to adjust | 7015 | window) or a function to be called with one argument - the |
| 7002 | the width of the window; its return value is ignored. | 7016 | chosen window. The function is supposed to adjust the width |
| 7003 | 7017 | of the window; its return value is ignored. | |
| 7004 | `allow-no-window' -- A non-nil value indicates readiness for the case | 7018 | 'preserve-size' -- The value should be either (t . nil) to |
| 7005 | of not displaying the buffer and FUNCTION can safely return | 7019 | preserve the width of the chosen window, (nil . t) to |
| 7006 | a non-window value to suppress displaying. | 7020 | preserve its height or (t . t) to preserve its height and |
| 7007 | 7021 | width in future changes of the window configuration. | |
| 7008 | `preserve-size' -- Value should be either (t . nil) to | 7022 | 'window-parameters' -- The value specifies an alist of window |
| 7009 | preserve the width of the window, (nil . t) to preserve its | 7023 | parameters to give the chosen window. |
| 7010 | height or (t . t) to preserve both. | 7024 | 'allow-no-window' -- A non-nil value means that `display-buffer' |
| 7011 | 7025 | may not display the buffer and return nil immediately. | |
| 7012 | `window-parameters' -- Value specifies an alist of window | 7026 | |
| 7013 | parameters to give the chosen window. | 7027 | The entries 'window-height', 'window-width' and 'preserve-size' |
| 7014 | 7028 | are applied only when the window used for displaying the buffer | |
| 7015 | The ACTION argument to `display-buffer' can also have a non-nil | 7029 | never showed another buffer before. |
| 7016 | and non-list value. This means to display the buffer in a window | 7030 | |
| 7017 | other than the selected one, even if it is already displayed in | 7031 | The ACTION argument can also have a non-nil and non-list value. |
| 7018 | the selected window. If called interactively with a prefix | 7032 | This means to display the buffer in a window other than the |
| 7019 | argument, ACTION is t." | 7033 | selected one, even if it is already displayed in the selected |
| 7034 | window. If called interactively with a prefix argument, ACTION | ||
| 7035 | is t. Non-interactive calls should always supply a list or nil. | ||
| 7036 | |||
| 7037 | The optional third argument FRAME, if non-nil, acts like a | ||
| 7038 | \(reusable-frames . FRAME) entry appended to the action alist | ||
| 7039 | specified by the ACTION argument." | ||
| 7020 | (interactive (list (read-buffer "Display buffer: " (other-buffer)) | 7040 | (interactive (list (read-buffer "Display buffer: " (other-buffer)) |
| 7021 | (if current-prefix-arg t))) | 7041 | (if current-prefix-arg t))) |
| 7022 | (let ((buffer (if (bufferp buffer-or-name) | 7042 | (let ((buffer (if (bufferp buffer-or-name) |
| @@ -7074,9 +7094,10 @@ its documentation for additional customization information." | |||
| 7074 | ;;; `display-buffer' action functions: | 7094 | ;;; `display-buffer' action functions: |
| 7075 | 7095 | ||
| 7076 | (defun display-buffer-use-some-frame (buffer alist) | 7096 | (defun display-buffer-use-some-frame (buffer alist) |
| 7077 | "Display BUFFER in an existing frame that meets a predicate | 7097 | "Display BUFFER in an existing frame that meets a predicate. |
| 7078 | \(by default any frame other than the current frame). If | 7098 | The default predicate is to use any frame other than the selected |
| 7079 | successful, return the window used; otherwise return nil. | 7099 | frame. If successful, return the window used; otherwise return |
| 7100 | nil. | ||
| 7080 | 7101 | ||
| 7081 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid | 7102 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid |
| 7082 | raising the frame. | 7103 | raising the frame. |
| @@ -7089,17 +7110,18 @@ predicate. | |||
| 7089 | If ALIST has a non-nil `inhibit-same-window' entry, avoid using | 7110 | If ALIST has a non-nil `inhibit-same-window' entry, avoid using |
| 7090 | the currently selected window (only useful with a frame-predicate | 7111 | the currently selected window (only useful with a frame-predicate |
| 7091 | that allows the selected frame)." | 7112 | that allows the selected frame)." |
| 7092 | (let* ((predicate (or (cdr (assq 'frame-predicate alist)) | 7113 | (let* ((predicate |
| 7093 | (lambda (frame) | 7114 | (or (cdr (assq 'frame-predicate alist)) |
| 7094 | (and | 7115 | (lambda (frame) |
| 7095 | (not (eq frame (selected-frame))) | 7116 | (and (not (eq frame (selected-frame))) |
| 7096 | (not (window-dedicated-p | 7117 | (not (window-dedicated-p |
| 7097 | (or | 7118 | (or (get-lru-window frame) |
| 7098 | (get-lru-window frame) | 7119 | (frame-first-window frame)))))))) |
| 7099 | (frame-first-window frame))))) | ||
| 7100 | ))) | ||
| 7101 | (frame (car (filtered-frame-list predicate))) | 7120 | (frame (car (filtered-frame-list predicate))) |
| 7102 | (window (and frame (get-lru-window frame nil (cdr (assq 'inhibit-same-window alist)))))) | 7121 | (window |
| 7122 | (and frame | ||
| 7123 | (get-lru-window | ||
| 7124 | frame nil (cdr (assq 'inhibit-same-window alist)))))) | ||
| 7103 | (when window | 7125 | (when window |
| 7104 | (prog1 | 7126 | (prog1 |
| 7105 | (window--display-buffer | 7127 | (window--display-buffer |