Applications should never rebind this variable. To resize a
window to a height less than the one specified here, an
-application should instead call `resize-window' with a non-nil
+application should instead call `window-resize' with a non-nil
IGNORE argument. In order to have `split-window' make a window
shorter, explictly specify the SIZE argument of that function."
:type 'integer
Applications should never rebind this variable. To resize a
window to a width less than the one specified here, an
-application should instead call `resize-window' with a non-nil
+application should instead call `window-resize' with a non-nil
IGNORE argument. In order to have `split-window' make a window
narrower, explictly specify the SIZE argument of that function."
:type 'integer
(length (window-list-1 nil minibuf)))
\f
;;; Resizing windows.
-(defun resize-window-reset (&optional frame horizontal)
+(defun window-resize-reset (&optional frame horizontal)
"Reset resize values for all windows on FRAME.
FRAME defaults to the selected frame.
with argument HORIZONTAL in the new total size of all windows on
FRAME. It also resets the new normal size of each of these
windows."
- (resize-window-reset-1
+ (window-resize-reset-1
(frame-root-window (normalize-live-frame frame)) horizontal))
-(defun resize-window-reset-1 (window horizontal)
- "Internal function of `resize-window-reset'."
+(defun window-resize-reset-1 (window horizontal)
+ "Internal function of `window-resize-reset'."
;; Register old size in the new total size.
(set-window-new-total window (window-total-size window horizontal))
;; Reset new normal size.
(set-window-new-normal window)
(when (window-child window)
- (resize-window-reset-1 (window-child window) horizontal))
+ (window-resize-reset-1 (window-child window) horizontal))
(when (window-right window)
- (resize-window-reset-1 (window-right window) horizontal)))
+ (window-resize-reset-1 (window-right window) horizontal)))
;; The following routine is used to manually resize the minibuffer
;; window and is currently used, for example, by ispell.el.
(setq delta min-delta)))
;; Resize now.
- (resize-window-reset frame)
+ (window-resize-reset frame)
;; Ideally we should be able to resize just the last subwindow of
;; root here. See the comment in `resize-root-window-vertically'
;; for why we do not do that.
;; a minibuffer-only frame.
(resize-mini-window-internal window))))
-(defun resize-window (window delta &optional horizontal ignore)
+(defun window-resize (window delta &optional horizontal ignore)
"Resize WINDOW vertically by DELTA lines.
WINDOW can be an arbitrary window and defaults to the selected
one. An attempt to resize the root window of a frame will raise
((window-minibuffer-p window)
(resize-mini-window window delta))
((window-resizable-p window delta horizontal ignore)
- (resize-window-reset frame horizontal)
+ (window-resize-reset frame horizontal)
(resize-this-window window delta horizontal ignore t)
(if (and (not (window-splits window))
(window-iso-combined-p window horizontal)
normal-delta)))
;; Otherwise, resize all other windows in the same combination.
(resize-other-windows window delta horizontal ignore))
- (resize-window-apply frame horizontal))
+ (window-resize-apply frame horizontal))
(t
(error "Cannot resize window %s" window)))))
(while sub
(when (or (consp (window-new-normal sub))
(numberp (window-new-normal sub)))
- ;; Reset new normal size fields so `resize-window-apply'
+ ;; Reset new normal size fields so `window-resize-apply'
;; won't use them to apply new sizes.
(set-window-new-normal sub))
new size. Make sure that WINDOW is `window-resizable' before
calling this function. Note that this function does not resize
siblings of WINDOW or WINDOW's parent window. You have to
-eventually call `resize-window-apply' in order to make resizing
+eventually call `window-resize-apply' in order to make resizing
actually take effect."
(when add
;; Add DELTA to the new total size of WINDOW.
resizes windows proportionally and never deletes any windows."
(when (and (windowp window) (numberp delta)
(window-sizable-p window delta horizontal ignore))
- (resize-window-reset (window-frame window) horizontal)
+ (window-resize-reset (window-frame window) horizontal)
(resize-this-window window delta horizontal ignore t)))
(defun resize-root-window-vertically (window delta)
(unless (window-sizable window delta)
(setq ignore t))))
- (resize-window-reset (window-frame window))
+ (window-resize-reset (window-frame window))
;; Ideally, we would resize just the last window in a combination
;; but that's not feasible for the following reason: If we grow
;; the minibuffer window and the last window cannot be shrunk any
(setq delta (min max-delta (- min-delta))))
(unless (zerop delta)
;; Start resizing.
- (resize-window-reset frame horizontal)
+ (window-resize-reset frame horizontal)
;; Try to enlarge LEFT first.
(setq this-delta (window-resizable left delta horizontal))
(unless (zerop this-delta)
(setq delta (max (- max-delta) min-delta)))
(unless (zerop delta)
;; Start resizing.
- (resize-window-reset frame horizontal)
+ (window-resize-reset frame horizontal)
;; Try to enlarge RIGHT.
(setq this-delta (window-resizable right (- delta) horizontal))
(unless (zerop this-delta)
(+ (window-top-line left) (window-total-size left)))))))
(unless (zerop delta)
;; Don't report an error in the standard case.
- (unless (resize-window-apply frame horizontal)
+ (unless (window-resize-apply frame horizontal)
;; But do report an error if applying the changes fails.
(error "Failed adjusting window %s" window)))))))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
((window-resizable-p nil delta horizontal)
- (resize-window nil delta horizontal))
+ (window-resize nil delta horizontal))
(t
- (resize-window
+ (window-resize
nil (if (> delta 0)
(window-max-delta nil horizontal)
(- (window-min-delta nil horizontal)))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
((window-resizable-p nil (- delta) horizontal)
- (resize-window nil (- delta) horizontal))
+ (window-resize nil (- delta) horizontal))
(t
- (resize-window
+ (window-resize
nil (if (> delta 0)
(- (window-min-delta nil horizontal))
(window-max-delta nil horizontal))
WINDOW can be any window and defaults to the selected window."
(interactive)
(setq window (normalize-any-window window))
- (resize-window window (window-max-delta window))
- (resize-window window (window-max-delta window t) t))
+ (window-resize window (window-max-delta window))
+ (window-resize window (window-max-delta window t) t))
(defun minimize-window (&optional window)
"Minimize WINDOW.
WINDOW can be any window and defaults to the selected window."
(interactive)
(setq window (normalize-any-window window))
- (resize-window window (- (window-min-delta window)))
- (resize-window window (- (window-min-delta window t)) t))
+ (window-resize window (- (window-min-delta window)))
+ (window-resize window (- (window-min-delta window t)) t))
\f
(defsubst frame-root-window-p (window)
"Return non-nil if WINDOW is the root window of its frame."
;; Emacs 23 preferably gives WINDOW's space to its left
;; sibling.
(sibling (or (window-left window) (window-right window))))
- (resize-window-reset frame horizontal)
+ (window-resize-reset frame horizontal)
(cond
((and (not (window-splits window))
sibling (window-sizable-p sibling size))
(set-window-start window (nth 1 quit-restore))
(set-window-point window (nth 2 quit-restore))
(when (and resize (/= (nth 4 quit-restore) (window-total-size window)))
- (resize-window
+ (window-resize
window (- (nth 4 quit-restore) (window-total-size window))))
;; Reset the quit-restore parameter.
(set-window-parameter window 'quit-restore nil)
;; SIZE specification violates minimum size restrictions.
(error "Window %s too small for splitting" window)))
- (resize-window-reset frame horizontal)
+ (window-resize-reset frame horizontal)
(setq new-parent
;; Make new-parent non-nil if we need a new parent window;
(error "Not a window or frame %s" window-or-frame))))
(frame (window-frame window)))
;; Balance vertically.
- (resize-window-reset (window-frame window))
+ (window-resize-reset (window-frame window))
(balance-windows-1 window)
- (resize-window-apply frame)
+ (window-resize-apply frame)
;; Balance horizontally.
- (resize-window-reset (window-frame window) t)
+ (window-resize-reset (window-frame window) t)
(balance-windows-1 window t)
- (resize-window-apply frame t)))
+ (window-resize-apply frame t)))
(defun window-fixed-size-p (&optional window direction)
"Return t if WINDOW cannot be resized in DIRECTION.
(make-variable-buffer-local 'window-area-factor)
(defun balance-windows-area-adjust (window delta horizontal)
- "Wrapper around `resize-window' with error checking.
+ "Wrapper around `window-resize' with error checking.
Arguments WINDOW, DELTA and HORIZONTAL are passed on to that function."
- ;; `resize-window' may fail if delta is too large.
+ ;; `window-resize' may fail if delta is too large.
(while (>= (abs delta) 1)
(condition-case nil
(progn
- (resize-window window delta horizontal)
+ (window-resize window delta horizontal)
(setq delta 0))
(error
;;(message "adjust: %s" (error-message-string err))
;; become significant.
(setq carry (+ carry areadiff))
;; This used `adjust-window-trailing-edge' before and uses
- ;; `resize-window' now. Error wrapping is still needed.
+ ;; `window-resize' now. Error wrapping is still needed.
(balance-windows-area-adjust win diff horiz)
;; (sit-for 0.5)
(let ((change (cons win (window-edges win))))
(window-total-height window)))
window-size-fixed)
(when (window-resizable-p window delta)
- (resize-window window delta)))
+ (window-resize window delta)))
;; Else check whether the window is not high enough.
(let* ((min-size (window-min-size window nil ignore))
(delta (- min-size (window-total-size window))))
(when (and (> delta 0)
(window-resizable-p window delta nil ignore))
- (resize-window window delta nil ignore))))
+ (window-resize window delta nil ignore))))
;; Adjust horizontally.
(if (memq window-size-fixed '(t width))
;; A fixed width window, try to restore the original size.
(window-total-width window)))
window-size-fixed)
(when (window-resizable-p window delta)
- (resize-window window delta)))
+ (window-resize window delta)))
;; Else check whether the window is not wide enough.
(let* ((min-size (window-min-size window t ignore))
(delta (- min-size (window-total-size window t))))
(when (and (> delta 0)
(window-resizable-p window delta t ignore))
- (resize-window window delta t ignore))))
+ (window-resize window delta t ignore))))
;; Set dedicated status.
(set-window-dedicated-p window (cdr (assq 'dedicated state)))
;; Install positions (maybe we should do this after all windows
:tag "Label"
:format "%v"
:help-echo "A symbol equalling the buffer display label."
- (const :format "" symbol)
+ (const :format "" label)
(symbol :format "Label: %v\n" :size 32))))
;; Display specifiers.
;; WINDOW and the selected one. But for a simple two windows
;; configuration the present behavior is good enough so why care?
(ignore-errors
- (resize-window
+ (window-resize
window (/ (- (window-total-height) (window-total-height window))
2))))
((and (window-iso-combined-p window t)
;; Don't throw an error if we can't even window widths, see
;; comment above.
(ignore-errors
- (resize-window
+ (window-resize
window (/ (- (window-total-width) (window-total-width window))
2) t)))))
(delta (- height (window-total-size window))))
(when (and (window-resizable-p window delta nil 'safe)
(window-iso-combined-p window))
- (resize-window window delta nil 'safe))))
+ (window-resize window delta nil 'safe))))
((functionp set-height)
(ignore-errors (funcall set-height window))))))
(delta (- width (window-total-size window t))))
(when (and (window-resizable-p window delta t 'safe)
(window-iso-combined-p window t))
- (resize-window window delta t 'safe))))
+ (window-resize window delta t 'safe))))
((functionp set-width)
(ignore-errors (funcall set-width window))))))
(let* ((method-window (nth 0 method))
(method-buffer (nth 1 method))
(method-frame (nth 2 method))
- (reuse-dedicated (assq 'reuse-window-dedicated specifiers))
+ (reuse-dedicated (cdr (assq 'reuse-window-dedicated specifiers)))
windows other-frame dedicated time best-window best-time)
(when (eq method-frame 'other)
;; `other' is not handled by `window-list-1'.
;; windows 1-line tall, which means that there's no more space for
;; the modeline.
(let ((window-min-height (min 2 height))) ; One text line plus a modeline.
- (resize-window window delta)))))
+ (window-resize window delta)))))
(defun enlarge-window-horizontally (delta)
"Make selected window DELTA columns wider.
;; It's silly to put `point' at the end of the previous
;; line and so maybe force horizontal scrolling.
(set-window-point window (line-beginning-position 0)))
- ;; Call `resize-window' with OVERRIDE argument equal WINDOW.
- (resize-window window delta nil window)
+ ;; Call `window-resize' with OVERRIDE argument equal WINDOW.
+ (window-resize window delta nil window)
;; Check if the last line is surely fully visible. If
;; not, enlarge the window.
(let ((end (save-excursion
(while (and (< desired-height max-height)
(= desired-height (window-total-size))
(not (pos-visible-in-window-p end)))
- (resize-window window 1 nil window)
+ (window-resize window 1 nil window)
(setq desired-height (1+ desired-height)))))
(error (setq delta nil)))
delta))))
int (* fn) (struct window *, void *),
void *);
static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object);
-static int resize_window_check (struct window *, int);
-static void resize_window_apply (struct window *, int);
+static int window_resize_check (struct window *, int);
+static void window_resize_apply (struct window *, int);
static Lisp_Object select_window (Lisp_Object, Lisp_Object, int);
/* This is the window in which the terminal's cursor should
XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines));
w->top_line = r->top_line;
resize_root_window (window, delta, Qnil, Qnil);
- if (resize_window_check (w, 0))
- resize_window_apply (w, 0);
+ if (window_resize_check (w, 0))
+ window_resize_apply (w, 0);
else
{
resize_root_window (window, delta, Qnil, Qt);
- if (resize_window_check (w, 0))
- resize_window_apply (w, 0);
+ if (window_resize_check (w, 0))
+ window_resize_apply (w, 0);
else
resize_failed = 1;
}
XSETINT (delta, XINT (r->total_cols) - XINT (w->total_cols));
w->left_col = r->left_col;
resize_root_window (window, delta, Qt, Qnil);
- if (resize_window_check (w, 1))
- resize_window_apply (w, 1);
+ if (window_resize_check (w, 1))
+ window_resize_apply (w, 1);
else
{
resize_root_window (window, delta, Qt, Qt);
- if (resize_window_check (w, 1))
- resize_window_apply (w, 1);
+ if (window_resize_check (w, 1))
+ window_resize_apply (w, 1);
else
resize_failed = 1;
}
`window-min-height' or `window-min-width'. It does check that window
sizes do not drop below one line (two columns). */
static int
-resize_window_check (struct window *w, int horflag)
+window_resize_check (struct window *w, int horflag)
{
struct window *c;
while (c)
{
if ((XINT (c->new_total) != XINT (w->new_total))
- || !resize_window_check (c, horflag))
+ || !window_resize_check (c, horflag))
return 0;
c = NILP (c->next) ? 0 : XWINDOW (c->next);
}
int sum_of_sizes = 0;
while (c)
{
- if (!resize_window_check (c, horflag))
+ if (!window_resize_check (c, horflag))
return 0;
sum_of_sizes = sum_of_sizes + XINT (c->new_total);
c = NILP (c->next) ? 0 : XWINDOW (c->next);
int sum_of_sizes = 0;
while (c)
{
- if (!resize_window_check (c, horflag))
+ if (!window_resize_check (c, horflag))
return 0;
sum_of_sizes = sum_of_sizes + XINT (c->new_total);
c = NILP (c->next) ? 0 : XWINDOW (c->next);
while (c)
{
if ((XINT (c->new_total) != XINT (w->new_total))
- || !resize_window_check (c, horflag))
+ || !window_resize_check (c, horflag))
return 0;
c = NILP (c->next) ? 0 : XWINDOW (c->next);
}
each of these windows.
This function does not perform any error checks. Make sure you have
- run resize_window_check on W before applying this function. */
+ run window_resize_check on W before applying this function. */
static void
-resize_window_apply (struct window *w, int horflag)
+window_resize_apply (struct window *w, int horflag)
{
struct window *c;
int pos;
XSETFASTINT (c->left_col, pos);
else
XSETFASTINT (c->top_line, pos);
- resize_window_apply (c, horflag);
+ window_resize_apply (c, horflag);
if (!horflag)
pos = pos + XINT (c->total_lines);
c = NILP (c->next) ? 0 : XWINDOW (c->next);
XSETFASTINT (c->left_col, pos);
else
XSETFASTINT (c->top_line, pos);
- resize_window_apply (c, horflag);
+ window_resize_apply (c, horflag);
if (horflag)
pos = pos + XINT (c->total_cols);
c = NILP (c->next) ? 0 : XWINDOW (c->next);
}
-DEFUN ("resize-window-apply", Fresize_window_apply, Sresize_window_apply, 1, 2, 0,
+DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 1, 2, 0,
doc: /* Apply requested size values for window-tree of FRAME.
Optional argument HORIZONTAL omitted or nil means apply requested height
values. HORIZONTAL non-nil means apply requested width values.
f = XFRAME (frame);
r = XWINDOW (FRAME_ROOT_WINDOW (f));
- if (!resize_window_check (r, horflag)
+ if (!window_resize_check (r, horflag)
|| ! EQ (r->new_total, (horflag ? r->total_cols : r->total_lines)))
return Qnil;
BLOCK_INPUT;
- resize_window_apply (r, horflag);
+ window_resize_apply (r, horflag);
windows_or_buffers_changed++;
FRAME_WINDOW_SIZES_CHANGED (f) = 1;
XSETINT (delta, new_size - old_size);
/* Try a "normal" resize first. */
resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil);
- if (resize_window_check (r, horflag) && new_size == XINT (r->new_total))
- resize_window_apply (r, horflag);
+ if (window_resize_check (r, horflag) && new_size == XINT (r->new_total))
+ window_resize_apply (r, horflag);
else
{
/* Try with "reasonable" minimum sizes next. */
resize_root_window (root, delta, horflag ? Qt : Qnil, Qt);
- if (resize_window_check (r, horflag)
+ if (window_resize_check (r, horflag)
&& new_size == XINT (r->new_total))
- resize_window_apply (r, horflag);
+ window_resize_apply (r, horflag);
else
{
/* Finally, try with "safe" minimum sizes. */
resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe);
- if (resize_window_check (r, horflag)
+ if (window_resize_check (r, horflag)
&& new_size == XINT (r->new_total))
- resize_window_apply (r, horflag);
+ window_resize_apply (r, horflag);
else
{
/* We lost. Delete all windows but the frame's
XSETINT (p->new_total,
XINT (horflag ? p->total_cols : p->total_lines)
- XINT (total_size));
- if (!resize_window_check (p, horflag))
+ if (!window_resize_check (p, horflag))
error ("Window sizes don't fit");
else
/* Undo the temporary pretension. */
}
else
{
- if (!resize_window_check (o, horflag))
+ if (!window_resize_check (o, horflag))
error ("Resizing old window failed");
else if (XINT (total_size) + XINT (o->new_total)
!= XINT (horflag ? o->total_cols : o->total_lines))
n->total_cols = o->total_cols;
}
- /* Iso-coordinates and sizes are assigned by resize_window_apply,
+ /* Iso-coordinates and sizes are assigned by window_resize_apply,
get them ready here. */
n->new_total = total_size;
n->new_normal = normal_size;
BLOCK_INPUT;
- resize_window_apply (p, horflag);
+ window_resize_apply (p, horflag);
adjust_glyphs (f);
/* Set buffer of NEW to buffer of reference window. Don't run
any hooks. */
XWINDOW (s->next)->prev = sibling;
}
- if (resize_window_check (r, horflag)
+ if (window_resize_check (r, horflag)
&& EQ (r->new_total, (horflag ? r->total_cols : r->total_lines)))
/* We can delete WINDOW now. */
{
/* Block input. */
BLOCK_INPUT;
- resize_window_apply (p, horflag);
+ window_resize_apply (p, horflag);
windows_or_buffers_changed++;
Vwindow_list = Qnil;
root = FRAME_ROOT_WINDOW (f);
r = XWINDOW (root);
value = call2 (Qresize_root_window_vertically, root, make_number (- delta));
- if (INTEGERP (value) && resize_window_check (r, 0))
+ if (INTEGERP (value) && window_resize_check (r, 0))
{
BLOCK_INPUT;
- resize_window_apply (r, 0);
+ window_resize_apply (r, 0);
/* Grow the mini-window. */
XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
r = XWINDOW (root);
value = call2 (Qresize_root_window_vertically,
root, make_number (size - 1));
- if (INTEGERP (value) && resize_window_check (r, 0))
+ if (INTEGERP (value) && window_resize_check (r, 0))
{
BLOCK_INPUT;
- resize_window_apply (r, 0);
+ window_resize_apply (r, 0);
/* Shrink the mini-window. */
XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
r = XWINDOW (FRAME_ROOT_WINDOW (f));
height = XINT (r->total_lines) + XINT (w->total_lines);
- if (resize_window_check (r, 0)
+ if (window_resize_check (r, 0)
&& XINT (w->new_total) > 0
&& height == XINT (r->new_total) + XINT (w->new_total))
{
BLOCK_INPUT;
- resize_window_apply (r, 0);
+ window_resize_apply (r, 0);
w->total_lines = w->new_total;
XSETFASTINT (w->top_line, XINT (r->top_line) + XINT (r->total_lines));
defsubr (&Swindow_new_normal);
defsubr (&Sset_window_new_total);
defsubr (&Sset_window_new_normal);
- defsubr (&Sresize_window_apply);
+ defsubr (&Swindow_resize_apply);
defsubr (&Swindow_body_size);
defsubr (&Swindow_hscroll);
defsubr (&Sset_window_hscroll);