34 |
Also restore the selected window of each frame as it was at the start |
Also restore the selected window of each frame as it was at the start |
35 |
of this construct. |
of this construct. |
36 |
However, if a window has become dead, don't get an error, |
However, if a window has become dead, don't get an error, |
37 |
just refrain from reselecting it." |
just refrain from reselecting it. |
38 |
|
Return the value of the last form in BODY." |
39 |
`(let ((save-selected-window-window (selected-window)) |
`(let ((save-selected-window-window (selected-window)) |
40 |
;; It is necessary to save all of these, because calling |
;; It is necessary to save all of these, because calling |
41 |
;; select-window changes frame-selected-window for whatever |
;; select-window changes frame-selected-window for whatever |
64 |
(if header-line-format 1 0)))))) |
(if header-line-format 1 0)))))) |
65 |
|
|
66 |
(defun one-window-p (&optional nomini all-frames) |
(defun one-window-p (&optional nomini all-frames) |
67 |
"Return non-nil if the selected window is the only window (in its frame). |
"Return non-nil if the selected window is the only window. |
68 |
Optional arg NOMINI non-nil means don't count the minibuffer |
Optional arg NOMINI non-nil means don't count the minibuffer |
69 |
even if it is active. |
even if it is active. Otherwise, the minibuffer is counted |
70 |
|
when it is active. |
71 |
|
|
72 |
The optional arg ALL-FRAMES t means count windows on all frames. |
The optional arg ALL-FRAMES t means count windows on all frames. |
73 |
If it is `visible', count windows on all visible frames. |
If it is `visible', count windows on all visible frames. |
74 |
ALL-FRAMES nil or omitted means count only the selected frame, |
ALL-FRAMES nil or omitted means count only the selected frame, |
75 |
plus the minibuffer it uses (which may be on another frame). |
plus the minibuffer it uses (which may be on another frame). |
76 |
If ALL-FRAMES is neither nil nor t, count only the selected frame." |
ALL-FRAMES 0 means count all windows in all visible or iconified frames. |
77 |
|
If ALL-FRAMES is anything else, count only the selected frame." |
78 |
(let ((base-window (selected-window))) |
(let ((base-window (selected-window))) |
79 |
(if (and nomini (eq base-window (minibuffer-window))) |
(if (and nomini (eq base-window (minibuffer-window))) |
80 |
(setq base-window (next-window base-window))) |
(setq base-window (next-window base-window))) |
90 |
(let ((vert (nth 2 (window-scroll-bars window))) |
(let ((vert (nth 2 (window-scroll-bars window))) |
91 |
(hor nil)) |
(hor nil)) |
92 |
(when (or (eq vert t) (eq hor t)) |
(when (or (eq vert t) (eq hor t)) |
93 |
(let ((fcsb (frame-current-scroll-bars |
(let ((fcsb (frame-current-scroll-bars |
94 |
(window-frame (or window (selected-window)))))) |
(window-frame (or window (selected-window)))))) |
95 |
(if (eq vert t) |
(if (eq vert t) |
96 |
(setq vert (car fcsb))) |
(setq vert (car fcsb))) |
271 |
|
|
272 |
;; I think this should be the default; I think people will prefer it--rms. |
;; I think this should be the default; I think people will prefer it--rms. |
273 |
(defcustom split-window-keep-point t |
(defcustom split-window-keep-point t |
274 |
"*If non-nil, split windows keeps the original point in both children. |
"*If non-nil, \\[split-window-vertically] keeps the original point \ |
275 |
|
in both children. |
276 |
This is often more convenient for editing. |
This is often more convenient for editing. |
277 |
If nil, adjust point in each of the two windows to minimize redisplay. |
If nil, adjust point in each of the two windows to minimize redisplay. |
278 |
This is convenient on slow terminals, but point can move strangely." |
This is convenient on slow terminals, but point can move strangely. |
279 |
|
|
280 |
|
This option applies only to `split-window-vertically' and |
281 |
|
functions that call it. `split-window' always keeps the original |
282 |
|
point in both children," |
283 |
:type 'boolean |
:type 'boolean |
284 |
:group 'windows) |
:group 'windows) |
285 |
|
|
286 |
(defun split-window-vertically (&optional arg) |
(defun split-window-vertically (&optional arg) |
287 |
"Split current window into two windows, one above the other. |
"Split current window into two windows, one above the other. |
288 |
The uppermost window gets ARG lines and the other gets the rest. |
The uppermost window gets ARG lines and the other gets the rest. |
289 |
Negative arg means select the size of the lowermost window instead. |
Negative ARG means select the size of the lowermost window instead. |
290 |
With no argument, split equally or close to it. |
With no argument, split equally or close to it. |
291 |
Both windows display the same buffer now current. |
Both windows display the same buffer now current. |
292 |
|
|
293 |
If the variable `split-window-keep-point' is non-nil, both new windows |
If the variable `split-window-keep-point' is non-nil, both new windows |
294 |
will get the same value of point as the current window. This is often |
will get the same value of point as the current window. This is often |
295 |
more convenient for editing. |
more convenient for editing. The upper window is the selected window. |
296 |
|
|
297 |
Otherwise, we chose window starts so as to minimize the amount of |
Otherwise, we choose window starts so as to minimize the amount of |
298 |
redisplay; this is convenient on slow terminals. The new selected |
redisplay; this is convenient on slow terminals. The new selected |
299 |
window is the one that the current value of point appears in. The |
window is the one that the current value of point appears in. The |
300 |
value of point can change if the text around point is hidden by the |
value of point can change if the text around point is hidden by the |
301 |
new mode line." |
new mode line. |
302 |
|
|
303 |
|
Regardless of the value of `split-window-keep-point', the upper |
304 |
|
window is the original one and the return value is the new, lower |
305 |
|
window." |
306 |
(interactive "P") |
(interactive "P") |
307 |
(let ((old-w (selected-window)) |
(let ((old-w (selected-window)) |
308 |
(old-point (point)) |
(old-point (point)) |
350 |
(defun split-window-horizontally (&optional arg) |
(defun split-window-horizontally (&optional arg) |
351 |
"Split current window into two windows side by side. |
"Split current window into two windows side by side. |
352 |
This window becomes the leftmost of the two, and gets ARG columns. |
This window becomes the leftmost of the two, and gets ARG columns. |
353 |
Negative arg means select the size of the rightmost window instead. |
Negative ARG means select the size of the rightmost window instead. |
354 |
The argument includes the width of the window's scroll bar; if there |
The argument includes the width of the window's scroll bar; if there |
355 |
are no scroll bars, it includes the width of the divider column |
are no scroll bars, it includes the width of the divider column |
356 |
to the window's right, if any. No arg means split equally." |
to the window's right, if any. No ARG means split equally. |
357 |
|
|
358 |
|
The original, leftmost window remains selected. |
359 |
|
The return value is the new, rightmost window." |
360 |
(interactive "P") |
(interactive "P") |
361 |
(let ((old-w (selected-window)) |
(let ((old-w (selected-window)) |
362 |
(size (and arg (prefix-numeric-value arg)))) |
(size (and arg (prefix-numeric-value arg)))) |