From 014b53003767d673082f730642717ff6c6b83b56 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Tue, 19 Jun 2018 17:14:55 -0400 Subject: [PATCH] Support font-increase & font-decrease fns Support functions for increasing and decreasing Emacs's font size -- without requiring a full restart. --- emacs.d/wpc/packages/wpc-ui.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/emacs.d/wpc/packages/wpc-ui.el b/emacs.d/wpc/packages/wpc-ui.el index d712bf939..8ea90c468 100644 --- a/emacs.d/wpc/packages/wpc-ui.el +++ b/emacs.d/wpc/packages/wpc-ui.el @@ -12,6 +12,26 @@ ;; change font (add-to-list 'default-frame-alist '(font . "Operator Mono-10")) +(defconst wpc/font-size-step 10 + "The amount (%) by which to increase or decrease a font.") + +(defun wpc/increase-font () + "Increase font size." + (interactive) + (->> (face-attribute 'default :height) + (+ wpc/font-size-step) + (set-face-attribute 'default (selected-frame) :height))) + +(defun wpc/decrease-font () + "Decrease font size." + (interactive) + (->> (face-attribute 'default :height) + (+ (- wpc/font-size-step)) + (set-face-attribute 'default (selected-frame) :height))) + +(general-def "s-j" #'wpc/decrease-font) +(general-def "s-k" #'wpc/increase-font) + ;; smooth scrolling settings (setq scroll-step 1 scroll-conservatively 10000)