Created
March 26, 2018 08:37
-
-
Save c02y/c7124fbd2ec102bcb9c76cb677e1b08b to your computer and use it in GitHub Desktop.
set Emacs frame size according to resolution dynamically
This file contains 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 | |
(setq width-chars (/ (/ (x-display-pixel-width) (frame-char-width)) 2)) | |
(setq height-lines (- (/ (x-display-pixel-height) (frame-char-height)) 3)) | |
(setq default-frame-alist | |
`((top . 0) (left . 0) | |
(width . ,width-chars) | |
(height . ,height-lines))) | |
(if (> (x-display-pixel-width) 1500) | |
;; or Monaco, Bitstream Vera Sans Mono, Liberation Mono | |
;; (add-to-list 'default-frame-alist '(font . "PragmataPro-14")) | |
(add-to-list 'default-frame-alist '(font . "Input Mono Compressed-14")) | |
(add-to-list 'default-frame-alist '(font . "Input Mono Compressed-13"))) | |
)) | |
;; the following two settings are specifically for afternoon-theme | |
;; the combination colors of highlighted line and comments | |
;; (custom-set-faces | |
;; '(font-lock-comment-face | |
;; ((t (:foreground "gray60" :slant italic :weight normal :family "Menlo"))) | |
;; )) | |
;; (set-face-background 'highlight "gray30") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment