2

When I start Emacs (by clicking on a desktop icon), its frame is too big for the screen, so the mode-line/mini-buffer area is not visible.

It's not difficult to resize and reposition the frame, but it is irritating to have to do this every time one starts Emacs.

How can I preserve the size of the Emacs window across sessions?

2

Just as @Drew states. I use this:

(defconst frame-default-top      0  "The 'top'  position property of a frame.")
(defconst frame-default-left     0  "The 'left' position property of a frame.")
(defconst frame-default-height  60  "The default frame height.")
(defconst frame-default-width  188  "The default frame width.")

(add-to-list 'default-frame-alist (cons 'left   frame-default-left))
(add-to-list 'default-frame-alist (cons 'top    frame-default-top))
(add-to-list 'default-frame-alist (cons 'height frame-default-height))
(add-to-list 'default-frame-alist (cons 'width  frame-default-width))

If you want only the initial frame use initial-frame-alist. I set both which is probably overkill.

(add-to-list 'initial-frame-alist (cons 'left   frame-default-left))
(add-to-list 'initial-frame-alist (cons 'top    frame-default-top))
(add-to-list 'initial-frame-alist (cons 'height frame-default-height))
(add-to-list 'initial-frame-alist (cons 'width  frame-default-width))
2

Customize option default-frame-alist, in particular by providing a helpful value for frame parameter height:

M-x customize-option RET default-frame-alist RET

Be sure to save your changes to the value.

See the Elisp manual, nodes Initial Parameters and Size Parameters.

2

A slightly more concise version: ;; Set Frame width/height (setq default-frame-alist '((top . 25) (left . 275) (width . 105) (height . 60)))

This makes the frame centered and approximately 2/3 of a 13inch laptop screen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.