Created
January 21, 2011 21:18
-
-
Save nilcolor/790443 to your computer and use it in GitHub Desktop.
Set Emacs default frame size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun set-frame-size-according-to-resolution () | |
(interactive) | |
(if window-system | |
(progn | |
;; use 180 char wide window for largeish displays | |
;; and smaller 80 column windows for smaller displays | |
;; pick whatever numbers make sense for you | |
(if (> (x-display-pixel-width) 1280) | |
(add-to-list 'default-frame-alist (cons 'width 180)) | |
(add-to-list 'default-frame-alist (cons 'width 80))) | |
;; for the height, subtract a couple hundred pixels | |
;; from the screen height (for panels, menubars and | |
;; whatnot), then divide by the height of a char to | |
;; get the height we want | |
(add-to-list 'default-frame-alist | |
(cons 'height (/ (- (x-display-pixel-height) 200) (frame-char-height))))))) | |
(set-frame-size-according-to-resolution) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment