diff options
| author | Martin Rudalics | 2018-10-19 08:51:03 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2018-10-19 08:51:03 +0200 |
| commit | 2510126388c7732d6ff02bfeda59fe1af0968b1f (patch) | |
| tree | 5acc6083e2221c220b5c267723ee35dacbf7e39b | |
| parent | 7aaf9d8a7d314224a9a423286ebf289b60640039 (diff) | |
| download | emacs-2510126388c7732d6ff02bfeda59fe1af0968b1f.tar.gz emacs-2510126388c7732d6ff02bfeda59fe1af0968b1f.zip | |
Have 'split-window' handle 'up' and 'down' values (Bug#32790)
* lisp/window.el (split-window): Handle values of 'up' and 'down'
for SIDE argument (Bug#32790).
(window-in-direction): Amend doc-string as of yesterday's change.
| -rw-r--r-- | lisp/window.el | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/lisp/window.el b/lisp/window.el index e7f54cee56a..27d7e42280f 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -2262,14 +2262,14 @@ SIDE can be any of the symbols `left', `top', `right' or | |||
| 2262 | "Return window in DIRECTION as seen from WINDOW. | 2262 | "Return window in DIRECTION as seen from WINDOW. |
| 2263 | More precisely, return the nearest window in direction DIRECTION | 2263 | More precisely, return the nearest window in direction DIRECTION |
| 2264 | as seen from the position of `window-point' in window WINDOW. | 2264 | as seen from the position of `window-point' in window WINDOW. |
| 2265 | DIRECTION must be one of `above', `below', `left' or `right'. | 2265 | DIRECTION should be one of 'above', 'below', 'left' or 'right'. |
| 2266 | WINDOW must be a live window and defaults to the selected one. | 2266 | WINDOW must be a live window and defaults to the selected one. |
| 2267 | 2267 | ||
| 2268 | Do not return a window whose `no-other-window' parameter is | 2268 | Do not return a window whose 'no-other-window' parameter is |
| 2269 | non-nil. If the nearest window's `no-other-window' parameter is | 2269 | non-nil. If the nearest window's 'no-other-window' parameter is |
| 2270 | non-nil, try to find another window in the indicated direction. | 2270 | non-nil, try to find another window in the indicated direction. |
| 2271 | If, however, the optional argument IGNORE is non-nil, return that | 2271 | If, however, the optional argument IGNORE is non-nil, return that |
| 2272 | window even if its `no-other-window' parameter is non-nil. | 2272 | window even if its 'no-other-window' parameter is non-nil. |
| 2273 | 2273 | ||
| 2274 | Optional argument SIGN a negative number means to use the right | 2274 | Optional argument SIGN a negative number means to use the right |
| 2275 | or bottom edge of WINDOW as reference position instead of | 2275 | or bottom edge of WINDOW as reference position instead of |
| @@ -2278,7 +2278,7 @@ top edge of WINDOW as reference position. | |||
| 2278 | 2278 | ||
| 2279 | Optional argument WRAP non-nil means to wrap DIRECTION around | 2279 | Optional argument WRAP non-nil means to wrap DIRECTION around |
| 2280 | frame borders. This means to return for WINDOW at the top of the | 2280 | frame borders. This means to return for WINDOW at the top of the |
| 2281 | frame and DIRECTION `above' the minibuffer window if the frame | 2281 | frame and DIRECTION 'above' the minibuffer window if the frame |
| 2282 | has one, and a window at the bottom of the frame otherwise. | 2282 | has one, and a window at the bottom of the frame otherwise. |
| 2283 | 2283 | ||
| 2284 | Optional argument MINI nil means to return the minibuffer window | 2284 | Optional argument MINI nil means to return the minibuffer window |
| @@ -4917,26 +4917,29 @@ absolute value can be less than `window-min-height' or | |||
| 4917 | small as one line or two columns. SIZE defaults to half of | 4917 | small as one line or two columns. SIZE defaults to half of |
| 4918 | WINDOW's size. | 4918 | WINDOW's size. |
| 4919 | 4919 | ||
| 4920 | Optional third argument SIDE nil (or `below') specifies that the | 4920 | Optional third argument SIDE nil (or 'below') specifies that the |
| 4921 | new window shall be located below WINDOW. SIDE `above' means the | 4921 | new window shall be located below WINDOW. SIDE 'above' means the |
| 4922 | new window shall be located above WINDOW. In both cases SIZE | 4922 | new window shall be located above WINDOW. In both cases SIZE |
| 4923 | specifies the new number of lines for WINDOW (or the new window | 4923 | specifies the new number of lines for WINDOW (or the new window |
| 4924 | if SIZE is negative) including space reserved for the mode and/or | 4924 | if SIZE is negative) including space reserved for the mode and/or |
| 4925 | header line. | 4925 | header line. |
| 4926 | 4926 | ||
| 4927 | SIDE t (or `right') specifies that the new window shall be | 4927 | SIDE t (or 'right') specifies that the new window shall be |
| 4928 | located on the right side of WINDOW. SIDE `left' means the new | 4928 | located on the right side of WINDOW. SIDE 'left' means the new |
| 4929 | window shall be located on the left of WINDOW. In both cases | 4929 | window shall be located on the left of WINDOW. In both cases |
| 4930 | SIZE specifies the new number of columns for WINDOW (or the new | 4930 | SIZE specifies the new number of columns for WINDOW (or the new |
| 4931 | window provided SIZE is negative) including space reserved for | 4931 | window provided SIZE is negative) including space reserved for |
| 4932 | fringes and the scrollbar or a divider column. Any other non-nil | 4932 | fringes and the scrollbar or a divider column. |
| 4933 | value for SIDE is currently handled like t (or `right'). | 4933 | |
| 4934 | For compatibility reasons, SIDE 'up' and 'down' are interpreted | ||
| 4935 | as 'above' and 'below'. Any other non-nil value for SIDE is | ||
| 4936 | currently handled like t (or 'right'). | ||
| 4934 | 4937 | ||
| 4935 | PIXELWISE, if non-nil, means to interpret SIZE pixelwise. | 4938 | PIXELWISE, if non-nil, means to interpret SIZE pixelwise. |
| 4936 | 4939 | ||
| 4937 | If the variable `ignore-window-parameters' is non-nil or the | 4940 | If the variable `ignore-window-parameters' is non-nil or the |
| 4938 | `split-window' parameter of WINDOW equals t, do not process any | 4941 | 'split-window' parameter of WINDOW equals t, do not process any |
| 4939 | parameters of WINDOW. Otherwise, if the `split-window' parameter | 4942 | parameters of WINDOW. Otherwise, if the 'split-window' parameter |
| 4940 | of WINDOW specifies a function, call that function with all three | 4943 | of WINDOW specifies a function, call that function with all three |
| 4941 | arguments and return the value returned by that function. | 4944 | arguments and return the value returned by that function. |
| 4942 | 4945 | ||
| @@ -4952,6 +4955,8 @@ frame. The selected window is not changed by this function." | |||
| 4952 | (setq window (window-normalize-window window)) | 4955 | (setq window (window-normalize-window window)) |
| 4953 | (let* ((side (cond | 4956 | (let* ((side (cond |
| 4954 | ((not side) 'below) | 4957 | ((not side) 'below) |
| 4958 | ((eq side 'up) 'above) | ||
| 4959 | ((eq side 'down) 'below) | ||
| 4955 | ((memq side '(below above right left)) side) | 4960 | ((memq side '(below above right left)) side) |
| 4956 | (t 'right))) | 4961 | (t 'right))) |
| 4957 | (horizontal (not (memq side '(below above)))) | 4962 | (horizontal (not (memq side '(below above)))) |
| @@ -4975,10 +4980,10 @@ frame. The selected window is not changed by this function." | |||
| 4975 | (catch 'done | 4980 | (catch 'done |
| 4976 | (cond | 4981 | (cond |
| 4977 | ;; Ignore window parameters if either `ignore-window-parameters' | 4982 | ;; Ignore window parameters if either `ignore-window-parameters' |
| 4978 | ;; is t or the `split-window' parameter equals t. | 4983 | ;; is t or the 'split-window' parameter equals t. |
| 4979 | ((or ignore-window-parameters (eq function t))) | 4984 | ((or ignore-window-parameters (eq function t))) |
| 4980 | ((functionp function) | 4985 | ((functionp function) |
| 4981 | ;; The `split-window' parameter specifies the function to call. | 4986 | ;; The 'split-window' parameter specifies the function to call. |
| 4982 | ;; If that function is `ignore', do nothing. | 4987 | ;; If that function is `ignore', do nothing. |
| 4983 | (throw 'done (funcall function window size side))) | 4988 | (throw 'done (funcall function window size side))) |
| 4984 | ;; If WINDOW is part of an atomic window, split the root window | 4989 | ;; If WINDOW is part of an atomic window, split the root window |
| @@ -5011,10 +5016,10 @@ frame. The selected window is not changed by this function." | |||
| 5011 | (setq window-combination-limit t)) | 5016 | (setq window-combination-limit t)) |
| 5012 | 5017 | ||
| 5013 | (let* ((parent-pixel-size | 5018 | (let* ((parent-pixel-size |
| 5014 | ;; `parent-pixel-size' is the pixel size of WINDOW's | 5019 | ;; 'parent-pixel-size' is the pixel size of WINDOW's |
| 5015 | ;; parent, provided it has one. | 5020 | ;; parent, provided it has one. |
| 5016 | (when parent (window-size parent horizontal t))) | 5021 | (when parent (window-size parent horizontal t))) |
| 5017 | ;; `resize' non-nil means we are supposed to resize other | 5022 | ;; 'resize' non-nil means we are supposed to resize other |
| 5018 | ;; windows in WINDOW's combination. | 5023 | ;; windows in WINDOW's combination. |
| 5019 | (resize | 5024 | (resize |
| 5020 | (and window-combination-resize | 5025 | (and window-combination-resize |
| @@ -5023,9 +5028,9 @@ frame. The selected window is not changed by this function." | |||
| 5023 | (not (eq window-combination-limit t)) | 5028 | (not (eq window-combination-limit t)) |
| 5024 | ;; Resize makes sense in iso-combinations only. | 5029 | ;; Resize makes sense in iso-combinations only. |
| 5025 | (window-combined-p window horizontal))) | 5030 | (window-combined-p window horizontal))) |
| 5026 | ;; `old-pixel-size' is the current pixel size of WINDOW. | 5031 | ;; 'old-pixel-size' is the current pixel size of WINDOW. |
| 5027 | (old-pixel-size (window-size window horizontal t)) | 5032 | (old-pixel-size (window-size window horizontal t)) |
| 5028 | ;; `new-size' is the specified or calculated size of the | 5033 | ;; 'new-size' is the specified or calculated size of the |
| 5029 | ;; new window. | 5034 | ;; new window. |
| 5030 | new-pixel-size new-parent new-normal) | 5035 | new-pixel-size new-parent new-normal) |
| 5031 | (cond | 5036 | (cond |