diff options
author | William Carroll <wpcarro@gmail.com> | 2022-11-19T18·20-0800 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-11-19T19·36+0000 |
commit | 3d8849e68bc198efeb8a179a4bcf32771d7967fe (patch) | |
tree | 3204ba6d59d59c63b59dc660c111c32ea253f91b /users/wpcarro/emacs/.emacs.d/wpc/fonts.el | |
parent | 932c3b31bbb16b5d52d34fd65c51d2bd59f94762 (diff) |
fix(wpcarro/emacs): Support OSX build of Emacs r/5291
**TL;DR:** Most of these changes predicate behavior on the platform: - At buildtime this is `localSystem == $something`. (`localSystem` is from `readTree`) - At runtime this is `(memq window-system '(ns))`. - Add `coreutils` so `dired` listing with `--group-directories-first` works because that flag depends on the GNU version of `ls`. **Background:** I need to support a bunch of OSX users at $WORK. As such, I'm planning on using my MBP for the next few weeks to build empathy for our userbase and polish some currently rough edges. If I'm going to get an serious work done, I need my Emacs setup. Step one is making sure it can build and run. Change-Id: I918efccfa5f149e218aeea476c2c7df1c7b64ae8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7309 Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/emacs/.emacs.d/wpc/fonts.el')
-rw-r--r-- | users/wpcarro/emacs/.emacs.d/wpc/fonts.el | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/fonts.el b/users/wpcarro/emacs/.emacs.d/wpc/fonts.el index 9490896ae7cc..3d79b71157fb 100644 --- a/users/wpcarro/emacs/.emacs.d/wpc/fonts.el +++ b/users/wpcarro/emacs/.emacs.d/wpc/fonts.el @@ -35,84 +35,16 @@ (defconst fonts-size-step 10 "The amount (%) by which to increase or decrease a font.") -(defconst fonts-hacker-news-recommendations - '("APL385 Unicode" - "Go Mono" - "Sudo" - "Monoid" - "Input Mono Medium" ;; NOTE: Also "Input Mono Thin" is nice. - ) - "List of fonts optimized for programming I found in a HN article.") - -(defconst fonts-whitelist - (cycle-from-list - (list-concat - fonts-hacker-news-recommendations - '("JetBrainsMono" - "Mononoki Medium" - "Monospace" - "Operator Mono Light" - "Courier" - "Andale Mono" - "Source Code Pro" - "Terminus"))) - "This is a list of my preferred fonts.") - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 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. - -(cl-defun fonts-cycle (&key forward?) - "Cycle forwards when `FORWARD?' non-nil." - (let ((font (if forward? - (cycle-next! fonts-whitelist) - (cycle-prev! fonts-whitelist)))) - (message (s-concat "Active font: " font)) - (fonts-set font))) - -(defun fonts-next () - "Quickly cycle through preferred fonts." - (interactive) - (fonts-cycle :forward? t)) - -(defun fonts-prev () - "Quickly cycle through preferred fonts." - (interactive) - (fonts-cycle :forward? nil)) - (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-ivy-select () - "Select a font from an ivy prompt." - (interactive) - (fonts-whitelist-set - (ivy-read "Font: " (cycle-to-list fonts-whitelist)))) - -(defun fonts-print-current () - "Message the currently enabled font." - (interactive) - (message - (string-format "[fonts] Current font: \"%s\"" - (fonts-current)))) - -(defun fonts-current () - "Return the currently enabled font." - (cycle-current fonts-whitelist)) - (defun fonts-increase-size () "Increase font size." (interactive) @@ -130,7 +62,7 @@ The size of the font is determined by `fonts-size'." (defun fonts-reset-size () "Restore font size to its default value." (interactive) - (fonts-whitelist-set (fonts-current))) + (fonts-set (fonts-current) fonts-size)) (defun fonts-enable-ligatures () "Call this function to enable ligatures." |