diff options
Diffstat (limited to 'lisp/window.el')
| -rw-r--r-- | lisp/window.el | 85 |
1 files changed, 38 insertions, 47 deletions
diff --git a/lisp/window.el b/lisp/window.el index 968f47f4f31..e9f3a779785 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -3262,39 +3262,28 @@ frame. The selected window is not changed by this function." | |||
| 3262 | 3262 | ||
| 3263 | ;; I think this should be the default; I think people will prefer it--rms. | 3263 | ;; I think this should be the default; I think people will prefer it--rms. |
| 3264 | (defcustom split-window-keep-point t | 3264 | (defcustom split-window-keep-point t |
| 3265 | "If non-nil, \\[split-window-above-each-other] keeps the original point \ | 3265 | "If non-nil, \\[split-window-below] preserves point in the new window. |
| 3266 | in both children. | 3266 | If nil, adjust point in the two windows to minimize redisplay. |
| 3267 | This is often more convenient for editing. | 3267 | This option applies only to `split-window-below' and functions |
| 3268 | If nil, adjust point in each of the two windows to minimize redisplay. | 3268 | that call it. The low-level `split-window' function always keeps |
| 3269 | This is convenient on slow terminals, but point can move strangely. | 3269 | 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 | 3270 | :type 'boolean |
| 3275 | :group 'windows) | 3271 | :group 'windows) |
| 3276 | 3272 | ||
| 3277 | (defun split-window-above-each-other (&optional size) | 3273 | (defun split-window-below (&optional size) |
| 3278 | "Split selected window into two windows, one above the other. | 3274 | "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. | 3275 | The selected window is above. The newly split-off window is |
| 3280 | SIZE negative means the lower window gets -SIZE lines and the | 3276 | below, and displays the same buffer. Return the new window. |
| 3281 | upper one the rest. With no argument, split windows equally or | 3277 | |
| 3282 | close to it. Both windows display the same buffer, now current. | 3278 | If optional argument SIZE is omitted or nil, both windows get the |
| 3283 | 3279 | 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 | 3280 | \(selected) window gets SIZE lines. If SIZE is negative, the |
| 3285 | windows will get the same value of point as the selected window. | 3281 | lower (new) window gets -SIZE lines. |
| 3286 | This is often more convenient for editing. The upper window is | 3282 | |
| 3287 | the selected window. | 3283 | If the variable `split-window-keep-point' is non-nil, both |
| 3288 | 3284 | windows get the same value of point as the selected window. | |
| 3289 | Otherwise, we choose window starts so as to minimize the amount of | 3285 | Otherwise, the window starts are chosen so as to minimize the |
| 3290 | redisplay; this is convenient on slow terminals. The new selected | 3286 | 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") | 3287 | (interactive "P") |
| 3299 | (let ((old-window (selected-window)) | 3288 | (let ((old-window (selected-window)) |
| 3300 | (old-point (point)) | 3289 | (old-point (point)) |
| @@ -3328,19 +3317,21 @@ window." | |||
| 3328 | (set-window-parameter new-window 'quit-restore quit-restore))) | 3317 | (set-window-parameter new-window 'quit-restore quit-restore))) |
| 3329 | new-window)) | 3318 | new-window)) |
| 3330 | 3319 | ||
| 3331 | (defalias 'split-window-vertically 'split-window-above-each-other) | 3320 | (defalias 'split-window-vertically 'split-window-below) |
| 3332 | 3321 | ||
| 3333 | (defun split-window-side-by-side (&optional size) | 3322 | (defun split-window-right (&optional size) |
| 3334 | "Split selected window into two windows side by side. | 3323 | "Split the selected window into two side-by-side windows. |
| 3335 | The selected window becomes the left one and gets SIZE columns. | 3324 | The selected window is on the left. The newly split-off window |
| 3336 | SIZE negative means the right window gets -SIZE columns. | 3325 | is on the right, and displays the same buffer. Return the new |
| 3337 | 3326 | window. | |
| 3338 | SIZE includes the width of the window's scroll bar; if there are | ||
| 3339 | no scroll bars, it includes the width of the divider column to | ||
| 3340 | the window's right, if any. SIZE omitted or nil means split | ||
| 3341 | window equally. | ||
| 3342 | 3327 | ||
| 3343 | The selected window remains selected. Return the new window." | 3328 | If optional argument SIZE is omitted or nil, both windows get the |
| 3329 | same width, or close to it. If SIZE is positive, the left-hand | ||
| 3330 | \(selected) window gets SIZE columns. If SIZE is negative, the | ||
| 3331 | right-hand (new) window gets -SIZE columns. Here, SIZE includes | ||
| 3332 | the width of the window's scroll bar; if there are no scroll | ||
| 3333 | bars, it includes the width of the divider column to the window's | ||
| 3334 | right, if any." | ||
| 3344 | (interactive "P") | 3335 | (interactive "P") |
| 3345 | (let ((old-window (selected-window)) | 3336 | (let ((old-window (selected-window)) |
| 3346 | (size (and size (prefix-numeric-value size))) | 3337 | (size (and size (prefix-numeric-value size))) |
| @@ -3355,7 +3346,7 @@ The selected window remains selected. Return the new window." | |||
| 3355 | (set-window-parameter new-window 'quit-restore quit-restore))) | 3346 | (set-window-parameter new-window 'quit-restore quit-restore))) |
| 3356 | new-window)) | 3347 | new-window)) |
| 3357 | 3348 | ||
| 3358 | (defalias 'split-window-horizontally 'split-window-side-by-side) | 3349 | (defalias 'split-window-horizontally 'split-window-right) |
| 3359 | 3350 | ||
| 3360 | ;;; Balancing windows. | 3351 | ;;; Balancing windows. |
| 3361 | 3352 | ||
| @@ -4431,11 +4422,11 @@ split." | |||
| 4431 | (or (and (window-splittable-p window) | 4422 | (or (and (window-splittable-p window) |
| 4432 | ;; Split window vertically. | 4423 | ;; Split window vertically. |
| 4433 | (with-selected-window window | 4424 | (with-selected-window window |
| 4434 | (split-window-vertically))) | 4425 | (split-window-below))) |
| 4435 | (and (window-splittable-p window t) | 4426 | (and (window-splittable-p window t) |
| 4436 | ;; Split window horizontally. | 4427 | ;; Split window horizontally. |
| 4437 | (with-selected-window window | 4428 | (with-selected-window window |
| 4438 | (split-window-horizontally))) | 4429 | (split-window-right))) |
| 4439 | (and (eq window (frame-root-window (window-frame window))) | 4430 | (and (eq window (frame-root-window (window-frame window))) |
| 4440 | (not (window-minibuffer-p window)) | 4431 | (not (window-minibuffer-p window)) |
| 4441 | ;; If WINDOW is the only window on its frame and is not the | 4432 | ;; If WINDOW is the only window on its frame and is not the |
| @@ -4444,7 +4435,7 @@ split." | |||
| 4444 | (let ((split-height-threshold 0)) | 4435 | (let ((split-height-threshold 0)) |
| 4445 | (when (window-splittable-p window) | 4436 | (when (window-splittable-p window) |
| 4446 | (with-selected-window window | 4437 | (with-selected-window window |
| 4447 | (split-window-vertically))))))) | 4438 | (split-window-below))))))) |
| 4448 | 4439 | ||
| 4449 | (defun window--try-to-split-window (window) | 4440 | (defun window--try-to-split-window (window) |
| 4450 | "Try to split WINDOW. | 4441 | "Try to split WINDOW. |
| @@ -5741,8 +5732,8 @@ Otherwise, consult the value of `truncate-partial-width-windows' | |||
| 5741 | ;; change these. | 5732 | ;; change these. |
| 5742 | (define-key ctl-x-map "0" 'delete-window) | 5733 | (define-key ctl-x-map "0" 'delete-window) |
| 5743 | (define-key ctl-x-map "1" 'delete-other-windows) | 5734 | (define-key ctl-x-map "1" 'delete-other-windows) |
| 5744 | (define-key ctl-x-map "2" 'split-window-above-each-other) | 5735 | (define-key ctl-x-map "2" 'split-window-below) |
| 5745 | (define-key ctl-x-map "3" 'split-window-side-by-side) | 5736 | (define-key ctl-x-map "3" 'split-window-right) |
| 5746 | (define-key ctl-x-map "o" 'other-window) | 5737 | (define-key ctl-x-map "o" 'other-window) |
| 5747 | (define-key ctl-x-map "^" 'enlarge-window) | 5738 | (define-key ctl-x-map "^" 'enlarge-window) |
| 5748 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) | 5739 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) |