Vivek Haldar
dotEmacs Extract: Interactively change font size
I use this very often and find it extremely useful, so I thought I would share this.
This is what I use to interactively increase or decrease the font size in Emacs. It behaves just like Ctrl-+/- or Cmd-+/- in most browsers. I also have them bound to convenient keyboard shortcuts.
(defun zoom-in ()
"Increase font size by 10 points"
(interactive)
(set-face-attribute 'default nil
:height
(+ (face-attribute 'default :height)
10)))
(defun zoom-out ()
“Decrease font size by 10 points”
(interactive)
(set-face-attribute ‘default nil
:height
(- (face-attribute ‘default :height)
10)))
;; change font size, interactively
(global-set-key (kbd “C-.”) ‘zoom-in)
(global-set-key (kbd “C-,”) ‘zoom-out)