Function: enlarge-window

enlarge-window is an interactive and byte-compiled function defined in window.el.gz.

Signature

(enlarge-window DELTA &optional HORIZONTAL)

Documentation

Make the selected window DELTA lines taller.

Interactively, if no argument is given, make the selected window one line taller. If optional argument HORIZONTAL is non-nil, make selected window wider by DELTA columns. If DELTA is negative, shrink selected window by -DELTA lines or columns.

View in manual

Probably introduced at or before Emacs version 21.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun enlarge-window (delta &optional horizontal)
  "Make the selected window DELTA lines taller.
Interactively, if no argument is given, make the selected window
one line taller.  If optional argument HORIZONTAL is non-nil,
make selected window wider by DELTA columns.  If DELTA is
negative, shrink selected window by -DELTA lines or columns."
  (interactive "p")
  (let ((minibuffer-window (minibuffer-window)))
    (when (window-preserved-size nil horizontal)
      (window-preserve-size nil horizontal))
    (cond
     ((zerop delta))
     ((window-size-fixed-p nil horizontal)
      (user-error "Selected window has fixed size"))
     ((window-minibuffer-p)
      (if horizontal
	  (user-error "Cannot resize minibuffer window horizontally")
	(window--resize-mini-window
         (selected-window) (* delta (frame-char-height)))))
     ((and (not horizontal)
	   (window-full-height-p)
	   (eq (window-frame minibuffer-window) (selected-frame))
	   (not resize-mini-windows))
      ;; If the selected window is full height and `resize-mini-windows'
      ;; is nil, resize the minibuffer window.
      (window--resize-mini-window
       minibuffer-window (* (- delta) (frame-char-height))))
     ((window--resizable-p nil delta horizontal)
      (window-resize nil delta horizontal))
     ((window--resizable-p nil delta horizontal 'preserved)
      (window-resize nil delta horizontal 'preserved))
     ((eq this-command
	  (if horizontal 'enlarge-window-horizontally 'enlarge-window))
      ;; For backward compatibility don't signal an error unless this
      ;; command is `enlarge-window(-horizontally)'.
      (if horizontal
          (user-error "Cannot enlarge selected window horizontally")
        (user-error "Cannot enlarge selected window vertically")))
     (t
      (window-resize
       nil (if (> delta 0)
	       (window-max-delta nil horizontal)
	     (- (window-min-delta nil horizontal)))
       horizontal)))))