Emacs: Set Default Window Size

By Xah Lee. Date: . Last updated: .

Set Default Window (Emacs Frame) Size

Put this in your Emacs Init File:

(if (display-graphic-p)
    (progn
      (setq initial-frame-alist
            '(
              (tool-bar-lines . 0)
              (width . 106) ; chars
              (height . 60) ; lines
              (background-color . "honeydew")
              (left . 50)
              (top . 50)))
      (setq default-frame-alist
            '(
              (tool-bar-lines . 0)
              (width . 106)
              (height . 60)
              (background-color . "honeydew")
              (left . 50)
              (top . 50))))
  (progn
    (setq initial-frame-alist '( (tool-bar-lines . 0)))
    (setq default-frame-alist '( (tool-bar-lines . 0)))))

The display-graphic-p check if emacs is running in graphical environment. (that is, not terminal)

Many settings related to windows size are not relevant if emacs is running in terminal.

initial-frame-alist
Variable. Value is a Association List of settings for the first window emacs starts with.
[see Emacs: Show Variable Value]
default-frame-alist
Variable. Value is a Association List of any new window.

Frame Parameters (ELISP Manual)

Background Color for New Window

(setq default-frame-alist
  '((background-color . "honeydew")))

To see a list of color names emacs support, Alt+x list-colors-display.

Set Default Font