diff options
| author | Eli Zaretskii | 2019-08-03 12:15:03 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-08-03 12:15:03 +0300 |
| commit | 49a5b573b25b70b3efd288efab0e27af1191d8c7 (patch) | |
| tree | 73ed862a718b57d49418075e436f699021ed6722 | |
| parent | e56e85d227b9c14b02e9c938efe994176a015db2 (diff) | |
| download | emacs-49a5b573b25b70b3efd288efab0e27af1191d8c7.tar.gz emacs-49a5b573b25b70b3efd288efab0e27af1191d8c7.zip | |
Improve documentation of 'display-buffer-*' functions
* lisp/window.el (display-buffer-in-atom-window)
(display-buffer-in-side-window, display-buffer-same-window)
(display-buffer--maybe-same-window)
(display-buffer-reuse-window)
(display-buffer-reuse-mode-window)
(display-buffer-pop-up-frame, display-buffer-pop-up-window)
(display-buffer--maybe-pop-up-frame-or-window)
(display-buffer--maybe-pop-up-frame)
(display-buffer-in-child-frame, display-buffer-in-direction)
(display-buffer-below-selected, display-buffer-at-bottom)
(display-buffer-in-previous-window)
(display-buffer-use-some-window, display-buffer-no-window):
More details about the ALIST argument in the doc string. (Bug#19461)
| -rw-r--r-- | lisp/window.el | 92 |
1 files changed, 82 insertions, 10 deletions
diff --git a/lisp/window.el b/lisp/window.el index 8b12c4381f4..70e2bba7499 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -666,8 +666,9 @@ new window to that atomic window. Operations like `split-window' | |||
| 666 | or `delete-window', when applied to a constituent of an atomic | 666 | or `delete-window', when applied to a constituent of an atomic |
| 667 | window, are applied atomically to the root of that atomic window. | 667 | window, are applied atomically to the root of that atomic window. |
| 668 | 668 | ||
| 669 | ALIST is an association list of symbols and values. The | 669 | ALIST is an association list of action symbols and values. |
| 670 | following symbols can be used. | 670 | See Info node `(elisp) Buffer Display Action Alists' for |
| 671 | details of such alists. The following symbols can be used: | ||
| 671 | 672 | ||
| 672 | `window' specifies the existing window the new window shall be | 673 | `window' specifies the existing window the new window shall be |
| 673 | combined with. Use `window-atom-root' to make the new window a | 674 | combined with. Use `window-atom-root' to make the new window a |
| @@ -1000,8 +1001,10 @@ and may be called only if no window on SIDE exists yet." | |||
| 1000 | 1001 | ||
| 1001 | (defun display-buffer-in-side-window (buffer alist) | 1002 | (defun display-buffer-in-side-window (buffer alist) |
| 1002 | "Display BUFFER in a side window of the selected frame. | 1003 | "Display BUFFER in a side window of the selected frame. |
| 1003 | ALIST is an association list of symbols and values. The | 1004 | ALIST is an association list of action symbols and values. |
| 1004 | following special symbols can be used in ALIST. | 1005 | See Info node `(elisp) Buffer Display Action Alists' for |
| 1006 | details of such alists. | ||
| 1007 | The following special symbols can be used in ALIST: | ||
| 1005 | 1008 | ||
| 1006 | `side' denotes the side of the frame where the new window shall | 1009 | `side' denotes the side of the frame where the new window shall |
| 1007 | be located. Valid values are `bottom', `right', `top' and | 1010 | be located. Valid values are `bottom', `right', `top' and |
| @@ -7285,6 +7288,10 @@ The default predicate is to use any frame other than the selected | |||
| 7285 | frame. If successful, return the window used; otherwise return | 7288 | frame. If successful, return the window used; otherwise return |
| 7286 | nil. | 7289 | nil. |
| 7287 | 7290 | ||
| 7291 | ALIST is an association list of action symbols and values. | ||
| 7292 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7293 | details of such alists. | ||
| 7294 | |||
| 7288 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid | 7295 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid |
| 7289 | raising the frame. | 7296 | raising the frame. |
| 7290 | 7297 | ||
| @@ -7314,10 +7321,15 @@ that allows the selected frame)." | |||
| 7314 | 7321 | ||
| 7315 | (defun display-buffer-same-window (buffer alist) | 7322 | (defun display-buffer-same-window (buffer alist) |
| 7316 | "Display BUFFER in the selected window. | 7323 | "Display BUFFER in the selected window. |
| 7317 | This fails if ALIST has an `inhibit-same-window' element whose | 7324 | |
| 7318 | value is non-nil, or if the selected window is a minibuffer | 7325 | ALIST is an association list of action symbols and values. |
| 7319 | window or is dedicated to another buffer; in that case, return nil. | 7326 | See Info node `(elisp) Buffer Display Action Alists' for |
| 7320 | Otherwise, return the selected window." | 7327 | details of such alists. |
| 7328 | |||
| 7329 | This function fails if ALIST has an `inhibit-same-window' | ||
| 7330 | element whose value is non-nil, or if the selected window is a | ||
| 7331 | minibuffer window or is dedicated to another buffer; in that case, | ||
| 7332 | return nil. Otherwise, return the selected window." | ||
| 7321 | (unless (or (cdr (assq 'inhibit-same-window alist)) | 7333 | (unless (or (cdr (assq 'inhibit-same-window alist)) |
| 7322 | (window-minibuffer-p) | 7334 | (window-minibuffer-p) |
| 7323 | (window-dedicated-p)) | 7335 | (window-dedicated-p)) |
| @@ -7325,6 +7337,11 @@ Otherwise, return the selected window." | |||
| 7325 | 7337 | ||
| 7326 | (defun display-buffer--maybe-same-window (buffer alist) | 7338 | (defun display-buffer--maybe-same-window (buffer alist) |
| 7327 | "Conditionally display BUFFER in the selected window. | 7339 | "Conditionally display BUFFER in the selected window. |
| 7340 | |||
| 7341 | ALIST is an association list of action symbols and values. | ||
| 7342 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7343 | details of such alists. | ||
| 7344 | |||
| 7328 | If `same-window-p' returns non-nil for BUFFER's name, call | 7345 | If `same-window-p' returns non-nil for BUFFER's name, call |
| 7329 | `display-buffer-same-window' and return its value. Otherwise, | 7346 | `display-buffer-same-window' and return its value. Otherwise, |
| 7330 | return nil." | 7347 | return nil." |
| @@ -7336,6 +7353,10 @@ return nil." | |||
| 7336 | Preferably use a window on the selected frame if such a window | 7353 | Preferably use a window on the selected frame if such a window |
| 7337 | exists. Return nil if no usable window is found. | 7354 | exists. Return nil if no usable window is found. |
| 7338 | 7355 | ||
| 7356 | ALIST is an association list of action symbols and values. | ||
| 7357 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7358 | details of such alists. | ||
| 7359 | |||
| 7339 | If ALIST has a non-nil 'inhibit-same-window' entry, the selected | 7360 | If ALIST has a non-nil 'inhibit-same-window' entry, the selected |
| 7340 | window is not eligible for reuse. | 7361 | window is not eligible for reuse. |
| 7341 | 7362 | ||
| @@ -7391,6 +7412,10 @@ that frame." | |||
| 7391 | Display BUFFER in the returned window. Return nil if no usable | 7412 | Display BUFFER in the returned window. Return nil if no usable |
| 7392 | window is found. | 7413 | window is found. |
| 7393 | 7414 | ||
| 7415 | ALIST is an association list of action symbols and values. | ||
| 7416 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7417 | details of such alists. | ||
| 7418 | |||
| 7394 | If ALIST contains a `mode' entry, its value is a major mode (a | 7419 | If ALIST contains a `mode' entry, its value is a major mode (a |
| 7395 | symbol) or a list of modes. A window is a candidate if it | 7420 | symbol) or a list of modes. A window is a candidate if it |
| 7396 | displays a buffer that derives from one of the given modes. When | 7421 | displays a buffer that derives from one of the given modes. When |
| @@ -7470,6 +7495,10 @@ See `display-buffer' for the format of display actions." | |||
| 7470 | This works by calling `pop-up-frame-function'. If successful, | 7495 | This works by calling `pop-up-frame-function'. If successful, |
| 7471 | return the window used; otherwise return nil. | 7496 | return the window used; otherwise return nil. |
| 7472 | 7497 | ||
| 7498 | ALIST is an association list of action symbols and values. | ||
| 7499 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7500 | details of such alists. | ||
| 7501 | |||
| 7473 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid | 7502 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid |
| 7474 | raising the new frame. | 7503 | raising the new frame. |
| 7475 | 7504 | ||
| @@ -7496,6 +7525,10 @@ The new window is created on the selected frame, or in | |||
| 7496 | `last-nonminibuffer-frame' if no windows can be created there. | 7525 | `last-nonminibuffer-frame' if no windows can be created there. |
| 7497 | If successful, return the new window; otherwise return nil. | 7526 | If successful, return the new window; otherwise return nil. |
| 7498 | 7527 | ||
| 7528 | ALIST is an association list of action symbols and values. | ||
| 7529 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7530 | details of such alists. | ||
| 7531 | |||
| 7499 | If ALIST has a non-nil `inhibit-switch-frame' entry, then in the | 7532 | If ALIST has a non-nil `inhibit-switch-frame' entry, then in the |
| 7500 | event that the new window is created on another frame, avoid | 7533 | event that the new window is created on another frame, avoid |
| 7501 | raising the frame." | 7534 | raising the frame." |
| @@ -7524,6 +7557,10 @@ raising the frame." | |||
| 7524 | If `pop-up-frames' is non-nil (and not `graphic-only' on a | 7557 | If `pop-up-frames' is non-nil (and not `graphic-only' on a |
| 7525 | text-only terminal), try with `display-buffer-pop-up-frame'. | 7558 | text-only terminal), try with `display-buffer-pop-up-frame'. |
| 7526 | 7559 | ||
| 7560 | ALIST is an association list of action symbols and values. | ||
| 7561 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7562 | details of such alists. | ||
| 7563 | |||
| 7527 | If that cannot be done, and `pop-up-windows' is non-nil, try | 7564 | If that cannot be done, and `pop-up-windows' is non-nil, try |
| 7528 | again with `display-buffer-pop-up-window'." | 7565 | again with `display-buffer-pop-up-window'." |
| 7529 | (or (display-buffer--maybe-pop-up-frame buffer alist) | 7566 | (or (display-buffer--maybe-pop-up-frame buffer alist) |
| @@ -7532,7 +7569,11 @@ again with `display-buffer-pop-up-window'." | |||
| 7532 | (defun display-buffer--maybe-pop-up-frame (buffer alist) | 7569 | (defun display-buffer--maybe-pop-up-frame (buffer alist) |
| 7533 | "Try displaying BUFFER based on `pop-up-frames'. | 7570 | "Try displaying BUFFER based on `pop-up-frames'. |
| 7534 | If `pop-up-frames' is non-nil (and not `graphic-only' on a | 7571 | If `pop-up-frames' is non-nil (and not `graphic-only' on a |
| 7535 | text-only terminal), try with `display-buffer-pop-up-frame'." | 7572 | text-only terminal), try with `display-buffer-pop-up-frame'. |
| 7573 | |||
| 7574 | ALIST is an association list of action symbols and values. | ||
| 7575 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7576 | details of such alists." | ||
| 7536 | (and (if (eq pop-up-frames 'graphic-only) | 7577 | (and (if (eq pop-up-frames 'graphic-only) |
| 7537 | (display-graphic-p) | 7578 | (display-graphic-p) |
| 7538 | pop-up-frames) | 7579 | pop-up-frames) |
| @@ -7550,6 +7591,10 @@ By default, this either reuses a child frame of the selected | |||
| 7550 | frame or makes a new child frame of the selected frame. If | 7591 | frame or makes a new child frame of the selected frame. If |
| 7551 | successful, return the window used; otherwise return nil. | 7592 | successful, return the window used; otherwise return nil. |
| 7552 | 7593 | ||
| 7594 | ALIST is an association list of action symbols and values. | ||
| 7595 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7596 | details of such alists. | ||
| 7597 | |||
| 7553 | If ALIST has a non-nil 'child-frame-parameters' entry, the | 7598 | If ALIST has a non-nil 'child-frame-parameters' entry, the |
| 7554 | corresponding value is an alist of frame parameters to give the | 7599 | corresponding value is an alist of frame parameters to give the |
| 7555 | new frame. A 'parent-frame' parameter specifying the selected | 7600 | new frame. A 'parent-frame' parameter specifying the selected |
| @@ -7653,6 +7698,11 @@ ALIST is a buffer display alist." | |||
| 7653 | 7698 | ||
| 7654 | (defun display-buffer-in-direction (buffer alist) | 7699 | (defun display-buffer-in-direction (buffer alist) |
| 7655 | "Try to display BUFFER in a direction specified by ALIST. | 7700 | "Try to display BUFFER in a direction specified by ALIST. |
| 7701 | |||
| 7702 | ALIST is an association list of action symbols and values. | ||
| 7703 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7704 | details of such alists. | ||
| 7705 | |||
| 7656 | ALIST has to contain a 'direction' entry whose value should be | 7706 | ALIST has to contain a 'direction' entry whose value should be |
| 7657 | one of 'left', 'above' (or 'up'), 'right', and 'below' (or | 7707 | one of 'left', 'above' (or 'up'), 'right', and 'below' (or |
| 7658 | 'down'). Other values are usually interpreted as 'below'. | 7708 | 'down'). Other values are usually interpreted as 'below'. |
| @@ -7741,6 +7791,10 @@ create a new window below the selected one and show BUFFER there. | |||
| 7741 | If that attempt fails as well and there is a non-dedicated window | 7791 | If that attempt fails as well and there is a non-dedicated window |
| 7742 | below the selected one, use that window. | 7792 | below the selected one, use that window. |
| 7743 | 7793 | ||
| 7794 | ALIST is an association list of action symbols and values. | ||
| 7795 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7796 | details of such alists. | ||
| 7797 | |||
| 7744 | If ALIST contains a 'window-min-height' entry, this function | 7798 | If ALIST contains a 'window-min-height' entry, this function |
| 7745 | ensures that the window used is or can become at least as high as | 7799 | ensures that the window used is or can become at least as high as |
| 7746 | specified by that entry's value. Note that such an entry alone | 7800 | specified by that entry's value. Note that such an entry alone |
| @@ -7795,7 +7849,11 @@ must also contain a 'window-height' entry with the same value." | |||
| 7795 | This either reuses such a window provided it shows BUFFER | 7849 | This either reuses such a window provided it shows BUFFER |
| 7796 | already, splits a window at the bottom of the frame or the | 7850 | already, splits a window at the bottom of the frame or the |
| 7797 | frame's root window, or reuses some window at the bottom of the | 7851 | frame's root window, or reuses some window at the bottom of the |
| 7798 | selected frame." | 7852 | selected frame. |
| 7853 | |||
| 7854 | ALIST is an association list of action symbols and values. | ||
| 7855 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7856 | details of such alists." | ||
| 7799 | (let (bottom-window bottom-window-shows-buffer window) | 7857 | (let (bottom-window bottom-window-shows-buffer window) |
| 7800 | (walk-window-tree | 7858 | (walk-window-tree |
| 7801 | (lambda (window) | 7859 | (lambda (window) |
| @@ -7819,6 +7877,11 @@ selected frame." | |||
| 7819 | 7877 | ||
| 7820 | (defun display-buffer-in-previous-window (buffer alist) | 7878 | (defun display-buffer-in-previous-window (buffer alist) |
| 7821 | "Display BUFFER in a window previously showing it. | 7879 | "Display BUFFER in a window previously showing it. |
| 7880 | |||
| 7881 | ALIST is an association list of action symbols and values. | ||
| 7882 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7883 | details of such alists. | ||
| 7884 | |||
| 7822 | If ALIST has a non-nil `inhibit-same-window' entry, the selected | 7885 | If ALIST has a non-nil `inhibit-same-window' entry, the selected |
| 7823 | window is not usable. A dedicated window is usable only if it | 7886 | window is not usable. A dedicated window is usable only if it |
| 7824 | already shows BUFFER. If ALIST contains a `previous-window' | 7887 | already shows BUFFER. If ALIST contains a `previous-window' |
| @@ -7890,6 +7953,10 @@ apply the following order of preference: | |||
| 7890 | Search for a usable window, set that window to the buffer, and | 7953 | Search for a usable window, set that window to the buffer, and |
| 7891 | return the window. If no suitable window is found, return nil. | 7954 | return the window. If no suitable window is found, return nil. |
| 7892 | 7955 | ||
| 7956 | ALIST is an association list of action symbols and values. | ||
| 7957 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 7958 | details of such alists. | ||
| 7959 | |||
| 7893 | If ALIST has a non-nil `inhibit-switch-frame' entry, then in the | 7960 | If ALIST has a non-nil `inhibit-switch-frame' entry, then in the |
| 7894 | event that a window in another frame is chosen, avoid raising | 7961 | event that a window in another frame is chosen, avoid raising |
| 7895 | that frame." | 7962 | that frame." |
| @@ -7930,6 +7997,11 @@ that frame." | |||
| 7930 | 7997 | ||
| 7931 | (defun display-buffer-no-window (_buffer alist) | 7998 | (defun display-buffer-no-window (_buffer alist) |
| 7932 | "Display BUFFER in no window. | 7999 | "Display BUFFER in no window. |
| 8000 | |||
| 8001 | ALIST is an association list of action symbols and values. | ||
| 8002 | See Info node `(elisp) Buffer Display Action Alists' for | ||
| 8003 | details of such alists. | ||
| 8004 | |||
| 7933 | If ALIST has a non-nil `allow-no-window' entry, then don't display | 8005 | If ALIST has a non-nil `allow-no-window' entry, then don't display |
| 7934 | a window at all. This makes possible to override the default action | 8006 | a window at all. This makes possible to override the default action |
| 7935 | and avoid displaying the buffer. It is assumed that when the caller | 8007 | and avoid displaying the buffer. It is assumed that when the caller |