about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-11-21T02·46-0800
committerwpcarro <wpcarro@gmail.com>2022-11-21T17·12+0000
commitc537cc6fcee5f5cde4b0e6f8c5d6dcd5d8e3690f (patch)
tree20ce9d3100c1eecd5328bc7ebdc6d6e436a6edf3
parent878dc6c22717971f5dd4720f314f36c47a0c762e (diff)
refactor(wpcarro/emacs): Simplify fonts.el r/5300
- Drop `cycle` and all associated methods
- Fix call-sites depedencies

Change-Id: I35304424c0c3925f5bf7771dec33e75d326d0961
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7315
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/fonts.el24
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el4
2 files changed, 13 insertions, 15 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/fonts.el b/users/wpcarro/emacs/.emacs.d/wpc/fonts.el
index 3d79b71157..0f70f69c2b 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/fonts.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/fonts.el
@@ -9,15 +9,10 @@
 
 ;;; Code:
 
-;; TODO: `defcustom' font-size.
-;; TODO: `defcustom' fonts.
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Dependencies
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(require 'prelude)
-(require 'cycle)
 (require 'maybe)
 (require 'cl-lib)
 
@@ -25,15 +20,16 @@
 ;; Constants
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-;; TODO: Troubleshoot why "8" appears so large on my desktop.
-
-;; TODO: Consider having a different font size when I'm using my 4K monitor.
+(defgroup fonts nil
+  "Customize group for fonts configuration.")
 
-(defconst fonts-size "10"
-  "My preferred default font-size.")
+(defcustom fonts-size "10"
+  "My preferred default font-size."
+  :group 'fonts)
 
-(defconst fonts-size-step 10
-  "The amount (%) by which to increase or decrease a font.")
+(defcustom fonts-size-step 10
+  "The amount (%) by which to increase or decrease a font."
+  :group 'fonts)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Functions
@@ -45,6 +41,10 @@
       (set-frame-font (string-format "%s %s" font size) nil t)
     (set-frame-font font nil t)))
 
+(defun fonts-current ()
+  "Return the currently enabled font."
+  (symbol-name (font-get (face-attribute 'default :font) :family)))
+
 (defun fonts-increase-size ()
   "Increase font size."
   (interactive)
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el b/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
index ce2f8beb72..02904e83a5 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
@@ -166,9 +166,7 @@
 (when window-system
   ;; On OSX, JetBrainsMono is installed as "JetBrains Mono", and I'm
   ;; not sure how to change that.
-  (let ((font (if (memq window-system '(ns))
-		  "JetBrains Mono"
-		"JetBrainsMono")))
+  (let ((font (if (memq window-system '(ns)) "JetBrains Mono" "JetBrainsMono")))
     (fonts-set font)
     ;; Some themes (e.g. doom-acario-*) change the font for comments. This
     ;; should prevent that.