about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2018-06-19T21·14-0400
committerWilliam Carroll <wpcarro@gmail.com>2018-07-19T16·00-0400
commit014b53003767d673082f730642717ff6c6b83b56 (patch)
treee5ebc166bfab0e6da8c77fec26da7d277367ae39
parent0e73a0e77f938cc27b9aec90f697d6eca21b7ce8 (diff)
Support font-increase & font-decrease fns
Support functions for increasing and decreasing Emacs's font size --
without requiring a full restart.
-rw-r--r--emacs.d/wpc/packages/wpc-ui.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/emacs.d/wpc/packages/wpc-ui.el b/emacs.d/wpc/packages/wpc-ui.el
index d712bf939ffe..8ea90c468900 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)