Niklas Hansson
Niklas Hansson

Reputation: 473

Triple even-sized windows in Emacs on startup

I would like to set up Emacs to maximize (or specific size) and split my window horizontally into three equally sized frames on start up.

I have found other questions that are similar but not quite, Q1 and Q2.

Thank you.

EDIT: Maximize, not fullscreen.

Upvotes: 3

Views: 601

Answers (2)

kindahero
kindahero

Reputation: 5877

Okay here is what I come up, There will be more elegant way to it. Nonetheless this does you want.

  (defun split-windows-even-3 ()
    "split into 3 evenly"
    (interactive)
    (save-excursion
      (let ((ps (window-width)))
        (split-window-horizontally (/ ps 3))
        (other-window 1)
        (split-window-horizontally (/ ps 3)))))

  ;;; ADD HOOKS to startup
  ;;  split three
  (add-hook 'emacs-startup-hook 'split-windows-even-3)

  ;; Fullscreen 
  (add-hook 'emacs-startup-hook (lambda ()
                                  (set-frame-parameter nil 'fullscreen 'fullboth)))

UPDATE: now its working emacs23 and emacs24

Upvotes: 1

Nicolas Dudebout
Nicolas Dudebout

Reputation: 9262

To have equally sized windows you can use the command balance-windows (bound to C-x + for interactive use).

Upvotes: 6

Related Questions