Skip to content

Instantly share code, notes, and snippets.

@vegardsjo
Created March 11, 2017 15:13
Show Gist options
  • Select an option

  • Save vegardsjo/6c4c90d864b88247aed6c5626758a151 to your computer and use it in GitHub Desktop.

Select an option

Save vegardsjo/6c4c90d864b88247aed6c5626758a151 to your computer and use it in GitHub Desktop.
Set font height and zoom functionality for Emacs
(defun good-font-height ()
(- (/ (display-pixel-height) 5) 50))
(defun set-font-height (height)
(interactive (list (read-number "Font height: " (good-font-height))))
(set-face-attribute 'default nil :height height))
(defun zoom (inc)
(interactive "nIncrement: ")
(let ((new-font-height (+ (* 10 inc) (face-attribute 'default :height))))
(set-font-height new-font-height)
(message "Font height: %s" new-font-height)))
(set-font-height (good-font-height))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment