about summary refs log tree commit diff
path: root/emacs/.emacs.d/wpc/fonts.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-09-01T09·17+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-09-01T09·17+0100
commitfb5ec068ddd50f6bce41c7a0bad45673db787940 (patch)
tree19b4ff96983c08f451e7da5f58c95b8f6090ec84 /emacs/.emacs.d/wpc/fonts.el
parenta638e15c0dd14a25e6f032b08de5ee1575677497 (diff)
More Elisp linting
This should cover most of the remaining linting errors. After this, I expect
fewer than ten linting errors.
Diffstat (limited to 'emacs/.emacs.d/wpc/fonts.el')
-rw-r--r--emacs/.emacs.d/wpc/fonts.el81
1 files changed, 42 insertions, 39 deletions
diff --git a/emacs/.emacs.d/wpc/fonts.el b/emacs/.emacs.d/wpc/fonts.el
index 0fe7c578f248..f3c11c5cd195 100644
--- a/emacs/.emacs.d/wpc/fonts.el
+++ b/emacs/.emacs.d/wpc/fonts.el
@@ -1,5 +1,9 @@
 ;;; fonts.el --- Font preferences -*- lexical-binding: t -*-
+
 ;; Author: William Carroll <wpcarro@gmail.com>
+;; Version: 0.0.1
+;; URL: https://git.wpcarro.dev/wpcarro/briefcase
+;; Package-Requires: ((emacs "24.3"))
 
 ;;; Commentary:
 ;; Control my font preferences with ELisp.
@@ -8,7 +12,6 @@
 
 ;; TODO: `defcustom' font-size.
 ;; TODO: `defcustom' fonts.
-;; TODO: Remove wpc/ namespace.
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Dependencies
@@ -27,16 +30,16 @@
 
 ;; TODO: Consider having a different font size when I'm using my 4K monitor.
 
-(defconst fonts/size
-  (pcase (device/classify)
+(defconst fonts-size
+  (pcase (device-classify)
     ('work-laptop "10")
     ('work-desktop "8"))
   "My preferred default font-size, which is device specific.")
 
-(defconst fonts/size-step 10
+(defconst fonts-size-step 10
   "The amount (%) by which to increase or decrease a font.")
 
-(defconst fonts/hacker-news-recommendations
+(defconst fonts-hacker-news-recommendations
   '("APL385 Unicode"
     "Go Mono"
     "Sudo"
@@ -45,10 +48,10 @@
     )
   "List of fonts optimized for programming I found in a HN article.")
 
-(defconst fonts/whitelist
-  (cycle/from-list
-   (list/concat
-    fonts/hacker-news-recommendations
+(defconst fonts-whitelist
+  (cycle-from-list
+   (list-concat
+    fonts-hacker-news-recommendations
     '("JetBrainsMono"
       "Mononoki Medium"
       "Monospace"
@@ -63,75 +66,75 @@
 ;; Functions
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-;; TODO: fonts and fonts/whitelist make it difficult to name functions like
-;; fonts/set as a generic Emacs function vs choosing a font from the whitelist.
+;; TODO: fonts and fonts-whitelist make it difficult to name functions like
+;; fonts-set as a generic Emacs function vs choosing a font from the whitelist.
 
-(cl-defun fonts/cycle (&key forward?)
+(cl-defun fonts-cycle (&key forward?)
   "Cycle forwards when `FORWARD?' non-nil."
   (let ((font (if forward?
-                  (cycle/next fonts/whitelist)
-                (cycle/prev fonts/whitelist))))
+                  (cycle-next fonts-whitelist)
+                (cycle-prev fonts-whitelist))))
     (message (s-concat "Active font: " font))
-    (fonts/set font)))
+    (fonts-set font)))
 
-(defun fonts/next ()
+(defun fonts-next ()
   "Quickly cycle through preferred fonts."
   (interactive)
-  (fonts/cycle :forward? t))
+  (fonts-cycle :forward? t))
 
-(defun fonts/prev ()
+(defun fonts-prev ()
   "Quickly cycle through preferred fonts."
   (interactive)
-  (fonts/cycle :forward? nil))
+  (fonts-cycle :forward? nil))
 
-(defun fonts/set (font &optional size)
+(defun fonts-set (font &optional size)
   "Change the font to `FONT' with option integer, SIZE, in pixels."
   (if (maybe-some? size)
       (set-frame-font (string-format "%s %s" font size) nil t)
     (set-frame-font font nil t)))
 
-(defun fonts/whitelist-set (font)
-  "Focuses the FONT in the `fonts/whitelist' cycle.
-The size of the font is determined by `fonts/size'."
-  (prelude-assert (cycle/contains? font fonts/whitelist))
-  (cycle/focus (lambda (x) (equal x font)) fonts/whitelist)
-  (fonts/set (fonts/current) fonts/size))
+(defun fonts-whitelist-set (font)
+  "Focuses the FONT in the `fonts-whitelist' cycle.
+The size of the font is determined by `fonts-size'."
+  (prelude-assert (cycle-contains? font fonts-whitelist))
+  (cycle-focus (lambda (x) (equal x font)) fonts-whitelist)
+  (fonts-set (fonts-current) fonts-size))
 
-(defun fonts/ivy-select ()
+(defun fonts-ivy-select ()
   "Select a font from an ivy prompt."
   (interactive)
-  (fonts/whitelist-set
-   (ivy-read "Font: " (cycle/to-list fonts/whitelist))))
+  (fonts-whitelist-set
+   (ivy-read "Font: " (cycle-to-list fonts-whitelist))))
 
-(defun fonts/print-current ()
+(defun fonts-print-current ()
   "Message the currently enabled font."
   (interactive)
   (message
    (string-format "[fonts] Current font: \"%s\""
-                  (fonts/current))))
+                  (fonts-current))))
 
-(defun fonts/current ()
+(defun fonts-current ()
   "Return the currently enabled font."
-  (cycle/current fonts/whitelist))
+  (cycle-current fonts-whitelist))
 
-(defun fonts/increase-size ()
+(defun fonts-increase-size ()
   "Increase font size."
   (interactive)
   (->> (face-attribute 'default :height)
-       (+ fonts/size-step)
+       (+ fonts-size-step)
        (set-face-attribute 'default (selected-frame) :height)))
 
-(defun fonts/decrease-size ()
+(defun fonts-decrease-size ()
   "Decrease font size."
   (interactive)
   (->> (face-attribute 'default :height)
-       (+ (- fonts/size-step))
+       (+ (- fonts-size-step))
        (set-face-attribute 'default (selected-frame) :height)))
 
-(defun fonts/reset-size ()
+(defun fonts-reset-size ()
   "Restore font size to its default value."
   (interactive)
-  (fonts/whitelist-set (fonts/current)))
+  (fonts-whitelist-set (fonts-current)))
 
 (provide 'fonts)
 ;;; fonts.el ends here