diff options
Diffstat (limited to 'lisp/window.el')
| -rw-r--r-- | lisp/window.el | 150 |
1 files changed, 69 insertions, 81 deletions
diff --git a/lisp/window.el b/lisp/window.el index 968f47f4f31..9b12c204d48 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -196,7 +196,7 @@ narrower, explictly specify the SIZE argument of that function." | |||
| 196 | :version "24.1" | 196 | :version "24.1" |
| 197 | :group 'windows) | 197 | :group 'windows) |
| 198 | 198 | ||
| 199 | (defun window-iso-combination-p (&optional window horizontal) | 199 | (defun window-combination-p (&optional window horizontal) |
| 200 | "If WINDOW is a vertical combination return WINDOW's first child. | 200 | "If WINDOW is a vertical combination return WINDOW's first child. |
| 201 | WINDOW can be any window and defaults to the selected one. | 201 | WINDOW can be any window and defaults to the selected one. |
| 202 | Optional argument HORIZONTAL non-nil means return WINDOW's first | 202 | Optional argument HORIZONTAL non-nil means return WINDOW's first |
| @@ -206,16 +206,16 @@ child if WINDOW is a horizontal combination." | |||
| 206 | (window-left-child window) | 206 | (window-left-child window) |
| 207 | (window-top-child window))) | 207 | (window-top-child window))) |
| 208 | 208 | ||
| 209 | (defsubst window-iso-combined-p (&optional window horizontal) | 209 | (defsubst window-combined-p (&optional window horizontal) |
| 210 | "Return non-nil if and only if WINDOW is vertically combined. | 210 | "Return non-nil if and only if WINDOW is vertically combined. |
| 211 | WINDOW can be any window and defaults to the selected one. | 211 | WINDOW can be any window and defaults to the selected one. |
| 212 | Optional argument HORIZONTAL non-nil means return non-nil if and | 212 | Optional argument HORIZONTAL non-nil means return non-nil if and |
| 213 | only if WINDOW is horizontally combined." | 213 | only if WINDOW is horizontally combined." |
| 214 | (setq window (window-normalize-any-window window)) | 214 | (setq window (window-normalize-any-window window)) |
| 215 | (let ((parent (window-parent window))) | 215 | (let ((parent (window-parent window))) |
| 216 | (and parent (window-iso-combination-p parent horizontal)))) | 216 | (and parent (window-combination-p parent horizontal)))) |
| 217 | 217 | ||
| 218 | (defun window-iso-combinations (&optional window horizontal) | 218 | (defun window-combinations (&optional window horizontal) |
| 219 | "Return largest number of vertically arranged subwindows of WINDOW. | 219 | "Return largest number of vertically arranged subwindows of WINDOW. |
| 220 | WINDOW can be any window and defaults to the selected one. | 220 | WINDOW can be any window and defaults to the selected one. |
| 221 | Optional argument HORIZONTAL non-nil means to return the largest | 221 | Optional argument HORIZONTAL non-nil means to return the largest |
| @@ -225,14 +225,14 @@ number of horizontally arranged subwindows of WINDOW." | |||
| 225 | ((window-live-p window) | 225 | ((window-live-p window) |
| 226 | ;; If WINDOW is live, return 1. | 226 | ;; If WINDOW is live, return 1. |
| 227 | 1) | 227 | 1) |
| 228 | ((window-iso-combination-p window horizontal) | 228 | ((window-combination-p window horizontal) |
| 229 | ;; If WINDOW is iso-combined, return the sum of the values for all | 229 | ;; If WINDOW is iso-combined, return the sum of the values for all |
| 230 | ;; subwindows of WINDOW. | 230 | ;; subwindows of WINDOW. |
| 231 | (let ((child (window-child window)) | 231 | (let ((child (window-child window)) |
| 232 | (count 0)) | 232 | (count 0)) |
| 233 | (while child | 233 | (while child |
| 234 | (setq count | 234 | (setq count |
| 235 | (+ (window-iso-combinations child horizontal) | 235 | (+ (window-combinations child horizontal) |
| 236 | count)) | 236 | count)) |
| 237 | (setq child (window-right child))) | 237 | (setq child (window-right child))) |
| 238 | count)) | 238 | count)) |
| @@ -243,7 +243,7 @@ number of horizontally arranged subwindows of WINDOW." | |||
| 243 | (count 1)) | 243 | (count 1)) |
| 244 | (while child | 244 | (while child |
| 245 | (setq count | 245 | (setq count |
| 246 | (max (window-iso-combinations child horizontal) | 246 | (max (window-combinations child horizontal) |
| 247 | count)) | 247 | count)) |
| 248 | (setq child (window-right child))) | 248 | (setq child (window-right child))) |
| 249 | count)))) | 249 | count)))) |
| @@ -555,7 +555,7 @@ restrictions for that window only." | |||
| 555 | (if sub | 555 | (if sub |
| 556 | (let ((value 0)) | 556 | (let ((value 0)) |
| 557 | ;; WINDOW is an internal window. | 557 | ;; WINDOW is an internal window. |
| 558 | (if (window-iso-combined-p sub horizontal) | 558 | (if (window-combined-p sub horizontal) |
| 559 | ;; The minimum size of an iso-combination is the sum of | 559 | ;; The minimum size of an iso-combination is the sum of |
| 560 | ;; the minimum sizes of its subwindows. | 560 | ;; the minimum sizes of its subwindows. |
| 561 | (while sub | 561 | (while sub |
| @@ -669,7 +669,7 @@ doc-string of `window-sizable'." | |||
| 669 | (catch 'fixed | 669 | (catch 'fixed |
| 670 | (if sub | 670 | (if sub |
| 671 | ;; WINDOW is an internal window. | 671 | ;; WINDOW is an internal window. |
| 672 | (if (window-iso-combined-p sub horizontal) | 672 | (if (window-combined-p sub horizontal) |
| 673 | ;; An iso-combination is fixed size if all its subwindows | 673 | ;; An iso-combination is fixed size if all its subwindows |
| 674 | ;; are fixed-size. | 674 | ;; are fixed-size. |
| 675 | (progn | 675 | (progn |
| @@ -717,7 +717,7 @@ WINDOW can be resized in the desired direction. The functions | |||
| 717 | (let* ((parent (window-parent window)) | 717 | (let* ((parent (window-parent window)) |
| 718 | (sub (window-child parent))) | 718 | (sub (window-child parent))) |
| 719 | (catch 'done | 719 | (catch 'done |
| 720 | (if (window-iso-combined-p sub horizontal) | 720 | (if (window-combined-p sub horizontal) |
| 721 | ;; In an iso-combination throw DELTA if we find at least one | 721 | ;; In an iso-combination throw DELTA if we find at least one |
| 722 | ;; subwindow and that subwindow is either not of fixed-size | 722 | ;; subwindow and that subwindow is either not of fixed-size |
| 723 | ;; or we can ignore fixed-sizeness. | 723 | ;; or we can ignore fixed-sizeness. |
| @@ -797,7 +797,7 @@ least one other windows can be enlarged appropriately." | |||
| 797 | (let* ((parent (window-parent window)) | 797 | (let* ((parent (window-parent window)) |
| 798 | (sub (window-child parent))) | 798 | (sub (window-child parent))) |
| 799 | (catch 'fixed | 799 | (catch 'fixed |
| 800 | (if (window-iso-combined-p sub horizontal) | 800 | (if (window-combined-p sub horizontal) |
| 801 | ;; For an iso-combination calculate how much we can get from | 801 | ;; For an iso-combination calculate how much we can get from |
| 802 | ;; other subwindows. | 802 | ;; other subwindows. |
| 803 | (let ((skip (eq trail 'after))) | 803 | (let ((skip (eq trail 'after))) |
| @@ -1498,7 +1498,7 @@ instead." | |||
| 1498 | (window--resize-reset frame horizontal) | 1498 | (window--resize-reset frame horizontal) |
| 1499 | (window--resize-this-window window delta horizontal ignore t) | 1499 | (window--resize-this-window window delta horizontal ignore t) |
| 1500 | (if (and (not (window-splits window)) | 1500 | (if (and (not (window-splits window)) |
| 1501 | (window-iso-combined-p window horizontal) | 1501 | (window-combined-p window horizontal) |
| 1502 | (setq sibling (or (window-right window) (window-left window))) | 1502 | (setq sibling (or (window-right window) (window-left window))) |
| 1503 | (window-sizable-p sibling (- delta) horizontal ignore)) | 1503 | (window-sizable-p sibling (- delta) horizontal ignore)) |
| 1504 | ;; If window-splits returns nil for WINDOW, WINDOW is part of | 1504 | ;; If window-splits returns nil for WINDOW, WINDOW is part of |
| @@ -1819,7 +1819,7 @@ preferably only resize windows adjacent to EDGE." | |||
| 1819 | (when (window-parent window) | 1819 | (when (window-parent window) |
| 1820 | (let* ((parent (window-parent window)) | 1820 | (let* ((parent (window-parent window)) |
| 1821 | (sub (window-child parent))) | 1821 | (sub (window-child parent))) |
| 1822 | (if (window-iso-combined-p sub horizontal) | 1822 | (if (window-combined-p sub horizontal) |
| 1823 | ;; In an iso-combination try to extract DELTA from WINDOW's | 1823 | ;; In an iso-combination try to extract DELTA from WINDOW's |
| 1824 | ;; siblings. | 1824 | ;; siblings. |
| 1825 | (let ((first sub) | 1825 | (let ((first sub) |
| @@ -1935,7 +1935,7 @@ actually take effect." | |||
| 1935 | (let ((sub (window-child window))) | 1935 | (let ((sub (window-child window))) |
| 1936 | (cond | 1936 | (cond |
| 1937 | ((not sub)) | 1937 | ((not sub)) |
| 1938 | ((window-iso-combined-p sub horizontal) | 1938 | ((window-combined-p sub horizontal) |
| 1939 | ;; In an iso-combination resize subwindows according to their | 1939 | ;; In an iso-combination resize subwindows according to their |
| 1940 | ;; normal sizes. | 1940 | ;; normal sizes. |
| 1941 | (window--resize-subwindows | 1941 | (window--resize-subwindows |
| @@ -2010,7 +2010,7 @@ move it as far as possible in the desired direction." | |||
| 2010 | (right window) | 2010 | (right window) |
| 2011 | left this-delta min-delta max-delta failed) | 2011 | left this-delta min-delta max-delta failed) |
| 2012 | ;; Find the edge we want to move. | 2012 | ;; Find the edge we want to move. |
| 2013 | (while (and (or (not (window-iso-combined-p right horizontal)) | 2013 | (while (and (or (not (window-combined-p right horizontal)) |
| 2014 | (not (window-right right))) | 2014 | (not (window-right right))) |
| 2015 | (setq right (window-parent right)))) | 2015 | (setq right (window-parent right)))) |
| 2016 | (cond | 2016 | (cond |
| @@ -2029,7 +2029,7 @@ move it as far as possible in the desired direction." | |||
| 2029 | (or (window-left left) | 2029 | (or (window-left left) |
| 2030 | (progn | 2030 | (progn |
| 2031 | (while (and (setq left (window-parent left)) | 2031 | (while (and (setq left (window-parent left)) |
| 2032 | (not (window-iso-combined-p left horizontal)))) | 2032 | (not (window-combined-p left horizontal)))) |
| 2033 | (window-left left))))) | 2033 | (window-left left))))) |
| 2034 | (unless left | 2034 | (unless left |
| 2035 | (if horizontal | 2035 | (if horizontal |
| @@ -2043,7 +2043,7 @@ move it as far as possible in the desired direction." | |||
| 2043 | (or (window-right right) | 2043 | (or (window-right right) |
| 2044 | (progn | 2044 | (progn |
| 2045 | (while (and (setq right (window-parent right)) | 2045 | (while (and (setq right (window-parent right)) |
| 2046 | (not (window-iso-combined-p right horizontal)))) | 2046 | (not (window-combined-p right horizontal)))) |
| 2047 | (window-right right))))) | 2047 | (window-right right))))) |
| 2048 | (unless right | 2048 | (unless right |
| 2049 | (if horizontal | 2049 | (if horizontal |
| @@ -2852,7 +2852,7 @@ displayed there." | |||
| 2852 | (t | 2852 | (t |
| 2853 | ;; Switch to another buffer in window. | 2853 | ;; Switch to another buffer in window. |
| 2854 | (set-window-dedicated-p nil nil) | 2854 | (set-window-dedicated-p nil nil) |
| 2855 | (switch-to-prev-buffer nil 'kill))) | 2855 | (switch-to-prev-buffer nil 'bury))) |
| 2856 | 2856 | ||
| 2857 | ;; Always return nil. | 2857 | ;; Always return nil. |
| 2858 | nil)) | 2858 | nil)) |
| @@ -2985,7 +2985,6 @@ one. If non-nil, reset `quit-restore' parameter to nil." | |||
| 2985 | (setq resize (with-current-buffer buffer | 2985 | (setq resize (with-current-buffer buffer |
| 2986 | (and temp-buffer-resize-mode | 2986 | (and temp-buffer-resize-mode |
| 2987 | (/= (nth 3 quad) (window-total-size window))))) | 2987 | (/= (nth 3 quad) (window-total-size window))))) |
| 2988 | (unrecord-window-buffer window buffer) | ||
| 2989 | (set-window-dedicated-p window nil) | 2988 | (set-window-dedicated-p window nil) |
| 2990 | (when resize | 2989 | (when resize |
| 2991 | ;; Try to resize WINDOW to its old height but don't signal an | 2990 | ;; Try to resize WINDOW to its old height but don't signal an |
| @@ -2993,9 +2992,12 @@ one. If non-nil, reset `quit-restore' parameter to nil." | |||
| 2993 | (condition-case nil | 2992 | (condition-case nil |
| 2994 | (window-resize window (- (nth 3 quad) (window-total-size window))) | 2993 | (window-resize window (- (nth 3 quad) (window-total-size window))) |
| 2995 | (error nil))) | 2994 | (error nil))) |
| 2996 | ;; Restore WINDOW's previous buffer, window start and point. | 2995 | ;; Restore WINDOW's previous buffer, start and point position. |
| 2997 | (set-window-buffer-start-and-point | 2996 | (set-window-buffer-start-and-point |
| 2998 | window (nth 0 quad) (nth 1 quad) (nth 2 quad)) | 2997 | window (nth 0 quad) (nth 1 quad) (nth 2 quad)) |
| 2998 | ;; Unrecord WINDOW's buffer here (Bug#9937) to make sure it's not | ||
| 2999 | ;; re-recorded by `set-window-buffer'. | ||
| 3000 | (unrecord-window-buffer window buffer) | ||
| 2999 | ;; Reset the quit-restore parameter. | 3001 | ;; Reset the quit-restore parameter. |
| 3000 | (set-window-parameter window 'quit-restore nil) | 3002 | (set-window-parameter window 'quit-restore nil) |
| 3001 | ;; Select old window. | 3003 | ;; Select old window. |
| @@ -3142,7 +3144,7 @@ frame. The selected window is not changed by this function." | |||
| 3142 | (resize | 3144 | (resize |
| 3143 | (and window-splits (not window-nest) | 3145 | (and window-splits (not window-nest) |
| 3144 | ;; Resize makes sense in iso-combinations only. | 3146 | ;; Resize makes sense in iso-combinations only. |
| 3145 | (window-iso-combined-p window horizontal))) | 3147 | (window-combined-p window horizontal))) |
| 3146 | ;; `old-size' is the current size of WINDOW. | 3148 | ;; `old-size' is the current size of WINDOW. |
| 3147 | (old-size (window-total-size window horizontal)) | 3149 | (old-size (window-total-size window horizontal)) |
| 3148 | ;; `new-size' is the specified or calculated size of the | 3150 | ;; `new-size' is the specified or calculated size of the |
| @@ -3157,7 +3159,7 @@ frame. The selected window is not changed by this function." | |||
| 3157 | (min (- parent-size | 3159 | (min (- parent-size |
| 3158 | (window-min-size parent horizontal)) | 3160 | (window-min-size parent horizontal)) |
| 3159 | (/ parent-size | 3161 | (/ parent-size |
| 3160 | (1+ (window-iso-combinations | 3162 | (1+ (window-combinations |
| 3161 | parent horizontal)))) | 3163 | parent horizontal)))) |
| 3162 | ;; Else try to give the new window half the size | 3164 | ;; Else try to give the new window half the size |
| 3163 | ;; of WINDOW (plus an eventual odd line). | 3165 | ;; of WINDOW (plus an eventual odd line). |
| @@ -3220,13 +3222,13 @@ frame. The selected window is not changed by this function." | |||
| 3220 | ;; Make new-parent non-nil if we need a new parent window; | 3222 | ;; Make new-parent non-nil if we need a new parent window; |
| 3221 | ;; either because we want to nest or because WINDOW is not | 3223 | ;; either because we want to nest or because WINDOW is not |
| 3222 | ;; iso-combined. | 3224 | ;; iso-combined. |
| 3223 | (or window-nest (not (window-iso-combined-p window horizontal)))) | 3225 | (or window-nest (not (window-combined-p window horizontal)))) |
| 3224 | (setq new-normal | 3226 | (setq new-normal |
| 3225 | ;; Make new-normal the normal size of the new window. | 3227 | ;; Make new-normal the normal size of the new window. |
| 3226 | (cond | 3228 | (cond |
| 3227 | (size (/ (float new-size) (if new-parent old-size parent-size))) | 3229 | (size (/ (float new-size) (if new-parent old-size parent-size))) |
| 3228 | (new-parent 0.5) | 3230 | (new-parent 0.5) |
| 3229 | (resize (/ 1.0 (1+ (window-iso-combinations parent horizontal)))) | 3231 | (resize (/ 1.0 (1+ (window-combinations parent horizontal)))) |
| 3230 | (t (/ (window-normal-size window horizontal) 2.0)))) | 3232 | (t (/ (window-normal-size window horizontal) 2.0)))) |
| 3231 | 3233 | ||
| 3232 | (if resize | 3234 | (if resize |
| @@ -3262,39 +3264,28 @@ frame. The selected window is not changed by this function." | |||
| 3262 | 3264 | ||
| 3263 | ;; I think this should be the default; I think people will prefer it--rms. | 3265 | ;; I think this should be the default; I think people will prefer it--rms. |
| 3264 | (defcustom split-window-keep-point t | 3266 | (defcustom split-window-keep-point t |
| 3265 | "If non-nil, \\[split-window-above-each-other] keeps the original point \ | 3267 | "If non-nil, \\[split-window-below] preserves point in the new window. |
| 3266 | in both children. | 3268 | If nil, adjust point in the two windows to minimize redisplay. |
| 3267 | This is often more convenient for editing. | 3269 | This option applies only to `split-window-below' and functions |
| 3268 | If nil, adjust point in each of the two windows to minimize redisplay. | 3270 | that call it. The low-level `split-window' function always keeps |
| 3269 | This is convenient on slow terminals, but point can move strangely. | 3271 | the original point in both windows." |
| 3270 | |||
| 3271 | This option applies only to `split-window-above-each-other' and | ||
| 3272 | functions that call it. `split-window' always keeps the original | ||
| 3273 | point in both children." | ||
| 3274 | :type 'boolean | 3272 | :type 'boolean |
| 3275 | :group 'windows) | 3273 | :group 'windows) |
| 3276 | 3274 | ||
| 3277 | (defun split-window-above-each-other (&optional size) | 3275 | (defun split-window-below (&optional size) |
| 3278 | "Split selected window into two windows, one above the other. | 3276 | "Split the selected window into two windows, one above the other. |
| 3279 | The upper window gets SIZE lines and the lower one gets the rest. | 3277 | The selected window is above. The newly split-off window is |
| 3280 | SIZE negative means the lower window gets -SIZE lines and the | 3278 | below, and displays the same buffer. Return the new window. |
| 3281 | upper one the rest. With no argument, split windows equally or | 3279 | |
| 3282 | close to it. Both windows display the same buffer, now current. | 3280 | If optional argument SIZE is omitted or nil, both windows get the |
| 3283 | 3281 | same height, or close to it. If SIZE is positive, the upper | |
| 3284 | If the variable `split-window-keep-point' is non-nil, both new | 3282 | \(selected) window gets SIZE lines. If SIZE is negative, the |
| 3285 | windows will get the same value of point as the selected window. | 3283 | lower (new) window gets -SIZE lines. |
| 3286 | This is often more convenient for editing. The upper window is | 3284 | |
| 3287 | the selected window. | 3285 | If the variable `split-window-keep-point' is non-nil, both |
| 3288 | 3286 | windows get the same value of point as the selected window. | |
| 3289 | Otherwise, we choose window starts so as to minimize the amount of | 3287 | Otherwise, the window starts are chosen so as to minimize the |
| 3290 | redisplay; this is convenient on slow terminals. The new selected | 3288 | amount of redisplay; this is convenient on slow terminals." |
| 3291 | window is the one that the current value of point appears in. The | ||
| 3292 | value of point can change if the text around point is hidden by the | ||
| 3293 | new mode line. | ||
| 3294 | |||
| 3295 | Regardless of the value of `split-window-keep-point', the upper | ||
| 3296 | window is the original one and the return value is the new, lower | ||
| 3297 | window." | ||
| 3298 | (interactive "P") | 3289 | (interactive "P") |
| 3299 | (let ((old-window (selected-window)) | 3290 | (let ((old-window (selected-window)) |
| 3300 | (old-point (point)) | 3291 | (old-point (point)) |
| @@ -3328,19 +3319,21 @@ window." | |||
| 3328 | (set-window-parameter new-window 'quit-restore quit-restore))) | 3319 | (set-window-parameter new-window 'quit-restore quit-restore))) |
| 3329 | new-window)) | 3320 | new-window)) |
| 3330 | 3321 | ||
| 3331 | (defalias 'split-window-vertically 'split-window-above-each-other) | 3322 | (defalias 'split-window-vertically 'split-window-below) |
| 3332 | |||
| 3333 | (defun split-window-side-by-side (&optional size) | ||
| 3334 | "Split selected window into two windows side by side. | ||
| 3335 | The selected window becomes the left one and gets SIZE columns. | ||
| 3336 | SIZE negative means the right window gets -SIZE columns. | ||
| 3337 | 3323 | ||
| 3338 | SIZE includes the width of the window's scroll bar; if there are | 3324 | (defun split-window-right (&optional size) |
| 3339 | no scroll bars, it includes the width of the divider column to | 3325 | "Split the selected window into two side-by-side windows. |
| 3340 | the window's right, if any. SIZE omitted or nil means split | 3326 | The selected window is on the left. The newly split-off window |
| 3341 | window equally. | 3327 | is on the right, and displays the same buffer. Return the new |
| 3328 | window. | ||
| 3342 | 3329 | ||
| 3343 | The selected window remains selected. Return the new window." | 3330 | If optional argument SIZE is omitted or nil, both windows get the |
| 3331 | same width, or close to it. If SIZE is positive, the left-hand | ||
| 3332 | \(selected) window gets SIZE columns. If SIZE is negative, the | ||
| 3333 | right-hand (new) window gets -SIZE columns. Here, SIZE includes | ||
| 3334 | the width of the window's scroll bar; if there are no scroll | ||
| 3335 | bars, it includes the width of the divider column to the window's | ||
| 3336 | right, if any." | ||
| 3344 | (interactive "P") | 3337 | (interactive "P") |
| 3345 | (let ((old-window (selected-window)) | 3338 | (let ((old-window (selected-window)) |
| 3346 | (size (and size (prefix-numeric-value size))) | 3339 | (size (and size (prefix-numeric-value size))) |
| @@ -3355,7 +3348,7 @@ The selected window remains selected. Return the new window." | |||
| 3355 | (set-window-parameter new-window 'quit-restore quit-restore))) | 3348 | (set-window-parameter new-window 'quit-restore quit-restore))) |
| 3356 | new-window)) | 3349 | new-window)) |
| 3357 | 3350 | ||
| 3358 | (defalias 'split-window-horizontally 'split-window-side-by-side) | 3351 | (defalias 'split-window-horizontally 'split-window-right) |
| 3359 | 3352 | ||
| 3360 | ;;; Balancing windows. | 3353 | ;;; Balancing windows. |
| 3361 | 3354 | ||
| @@ -3368,7 +3361,8 @@ The selected window remains selected. Return the new window." | |||
| 3368 | ;; the smallest window). | 3361 | ;; the smallest window). |
| 3369 | (defun balance-windows-2 (window horizontal) | 3362 | (defun balance-windows-2 (window horizontal) |
| 3370 | "Subroutine of `balance-windows-1'. | 3363 | "Subroutine of `balance-windows-1'. |
| 3371 | WINDOW must be an iso-combination." | 3364 | WINDOW must be a vertical combination (horizontal if HORIZONTAL |
| 3365 | is non-nil." | ||
| 3372 | (let* ((first (window-child window)) | 3366 | (let* ((first (window-child window)) |
| 3373 | (sub first) | 3367 | (sub first) |
| 3374 | (number-of-children 0) | 3368 | (number-of-children 0) |
| @@ -3441,7 +3435,7 @@ WINDOW must be an iso-combination." | |||
| 3441 | "Subroutine of `balance-windows'." | 3435 | "Subroutine of `balance-windows'." |
| 3442 | (if (window-child window) | 3436 | (if (window-child window) |
| 3443 | (let ((sub (window-child window))) | 3437 | (let ((sub (window-child window))) |
| 3444 | (if (window-iso-combined-p sub horizontal) | 3438 | (if (window-combined-p sub horizontal) |
| 3445 | (balance-windows-2 window horizontal) | 3439 | (balance-windows-2 window horizontal) |
| 3446 | (let ((size (window-new-total window))) | 3440 | (let ((size (window-new-total window))) |
| 3447 | (while sub | 3441 | (while sub |
| @@ -4431,11 +4425,11 @@ split." | |||
| 4431 | (or (and (window-splittable-p window) | 4425 | (or (and (window-splittable-p window) |
| 4432 | ;; Split window vertically. | 4426 | ;; Split window vertically. |
| 4433 | (with-selected-window window | 4427 | (with-selected-window window |
| 4434 | (split-window-vertically))) | 4428 | (split-window-below))) |
| 4435 | (and (window-splittable-p window t) | 4429 | (and (window-splittable-p window t) |
| 4436 | ;; Split window horizontally. | 4430 | ;; Split window horizontally. |
| 4437 | (with-selected-window window | 4431 | (with-selected-window window |
| 4438 | (split-window-horizontally))) | 4432 | (split-window-right))) |
| 4439 | (and (eq window (frame-root-window (window-frame window))) | 4433 | (and (eq window (frame-root-window (window-frame window))) |
| 4440 | (not (window-minibuffer-p window)) | 4434 | (not (window-minibuffer-p window)) |
| 4441 | ;; If WINDOW is the only window on its frame and is not the | 4435 | ;; If WINDOW is the only window on its frame and is not the |
| @@ -4444,7 +4438,7 @@ split." | |||
| 4444 | (let ((split-height-threshold 0)) | 4438 | (let ((split-height-threshold 0)) |
| 4445 | (when (window-splittable-p window) | 4439 | (when (window-splittable-p window) |
| 4446 | (with-selected-window window | 4440 | (with-selected-window window |
| 4447 | (split-window-vertically))))))) | 4441 | (split-window-below))))))) |
| 4448 | 4442 | ||
| 4449 | (defun window--try-to-split-window (window) | 4443 | (defun window--try-to-split-window (window) |
| 4450 | "Try to split WINDOW. | 4444 | "Try to split WINDOW. |
| @@ -5030,7 +5024,7 @@ nil, BUFFER-OR-NAME may be displayed in another window. | |||
| 5030 | 5024 | ||
| 5031 | Return the buffer switched to." | 5025 | Return the buffer switched to." |
| 5032 | (interactive | 5026 | (interactive |
| 5033 | (list (read-buffer-to-switch "Switch to buffer: ") nil nil)) | 5027 | (list (read-buffer-to-switch "Switch to buffer: ") nil 'force-same-window)) |
| 5034 | (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))) | 5028 | (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))) |
| 5035 | (if (null force-same-window) | 5029 | (if (null force-same-window) |
| 5036 | (pop-to-buffer buffer display-buffer--same-window-action norecord) | 5030 | (pop-to-buffer buffer display-buffer--same-window-action norecord) |
| @@ -5290,14 +5284,8 @@ WINDOW was scrolled." | |||
| 5290 | WINDOW defaults to the selected window." | 5284 | WINDOW defaults to the selected window." |
| 5291 | (with-selected-window (or window (selected-window)) | 5285 | (with-selected-window (or window (selected-window)) |
| 5292 | (let ((edges (window-edges))) | 5286 | (let ((edges (window-edges))) |
| 5293 | ;; The following doesn't satisfy the doc-string's claim when | ||
| 5294 | ;; window and previous-/next-window are not part of the same | ||
| 5295 | ;; combination but still share a common edge. Using | ||
| 5296 | ;; `window-iso-combined-p' instead should handle that. | ||
| 5297 | (or (= (nth 2 edges) (nth 2 (window-edges (previous-window)))) | 5287 | (or (= (nth 2 edges) (nth 2 (window-edges (previous-window)))) |
| 5298 | (= (nth 0 edges) (nth 0 (window-edges (next-window)))))))) | 5288 | (= (nth 0 edges) (nth 0 (window-edges (next-window)))))))) |
| 5299 | ;; (make-obsolete | ||
| 5300 | ;; 'window-safely-shrinkable-p "use `window-iso-combined-p' instead." "24.1") | ||
| 5301 | 5289 | ||
| 5302 | (defun shrink-window-if-larger-than-buffer (&optional window) | 5290 | (defun shrink-window-if-larger-than-buffer (&optional window) |
| 5303 | "Shrink height of WINDOW if its buffer doesn't need so many lines. | 5291 | "Shrink height of WINDOW if its buffer doesn't need so many lines. |
| @@ -5317,7 +5305,7 @@ Return non-nil if the window was shrunk, nil otherwise." | |||
| 5317 | ;; Make sure that WINDOW is vertically combined and `point-min' is | 5305 | ;; Make sure that WINDOW is vertically combined and `point-min' is |
| 5318 | ;; visible (for whatever reason that's needed). The remaining issues | 5306 | ;; visible (for whatever reason that's needed). The remaining issues |
| 5319 | ;; should be taken care of by `fit-window-to-buffer'. | 5307 | ;; should be taken care of by `fit-window-to-buffer'. |
| 5320 | (when (and (window-iso-combined-p window) | 5308 | (when (and (window-combined-p window) |
| 5321 | (pos-visible-in-window-p (point-min) window)) | 5309 | (pos-visible-in-window-p (point-min) window)) |
| 5322 | (fit-window-to-buffer window (window-total-size window)))) | 5310 | (fit-window-to-buffer window (window-total-size window)))) |
| 5323 | 5311 | ||
| @@ -5741,8 +5729,8 @@ Otherwise, consult the value of `truncate-partial-width-windows' | |||
| 5741 | ;; change these. | 5729 | ;; change these. |
| 5742 | (define-key ctl-x-map "0" 'delete-window) | 5730 | (define-key ctl-x-map "0" 'delete-window) |
| 5743 | (define-key ctl-x-map "1" 'delete-other-windows) | 5731 | (define-key ctl-x-map "1" 'delete-other-windows) |
| 5744 | (define-key ctl-x-map "2" 'split-window-above-each-other) | 5732 | (define-key ctl-x-map "2" 'split-window-below) |
| 5745 | (define-key ctl-x-map "3" 'split-window-side-by-side) | 5733 | (define-key ctl-x-map "3" 'split-window-right) |
| 5746 | (define-key ctl-x-map "o" 'other-window) | 5734 | (define-key ctl-x-map "o" 'other-window) |
| 5747 | (define-key ctl-x-map "^" 'enlarge-window) | 5735 | (define-key ctl-x-map "^" 'enlarge-window) |
| 5748 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) | 5736 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) |