From 705e8d4b7b3dfc0e70fe634d223ceea81661de1e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 22 Dec 2020 00:14:58 -0600 Subject: Correct set-face-from-alternatives function --- README.md | 14 +++++--------- config.org | 30 +++++++++++++----------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index a35da41..9e0e26d 100644 --- a/README.md +++ b/README.md @@ -398,18 +398,14 @@ from [link0ff](https://github.com/link0ff/emacs-init). 1. Define fonts - (defun font-candidate (&rest fonts) - (catch :font - (dolist (font fonts) - (if (find-font (font-spec :name font)) - (throw :font font))))) - (defun set-face-from-alternatives (face fonts) - (dolist (font fonts) - (if (find-font (font-spec :family (car font))) + (catch :return + (dolist (font fonts) + (when (find-font (font-spec :family (car font))) (apply #'set-face-attribute `(,face nil :family ,(car font) - ,@(cdr font)))))) + ,@(cdr font))) + (throw :return font))))) (defun acdw/setup-fonts () "Setup fonts. This has to happen after the frame is setup for diff --git a/config.org b/config.org index c0ecb10..3d39f7a 100644 --- a/config.org +++ b/config.org @@ -4,7 +4,7 @@ #+EXPORT_FILE_NAME: README.md #+OPTIONS: toc:nil #+BANKRUPTCY_COUNT: 3 -#+Time-stamp: <2020-12-21 17:20:22 aduckworth> +#+Time-stamp: <2020-12-22 00:16:24 acdw> Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. @@ -431,18 +431,14 @@ from [[https://github.com/link0ff/emacs-init][link0ff]]. **** Define fonts #+begin_src emacs-lisp - (defun font-candidate (&rest fonts) - (catch :font - (dolist (font fonts) - (if (find-font (font-spec :name font)) - (throw :font font))))) - (defun set-face-from-alternatives (face fonts) - (dolist (font fonts) - (if (find-font (font-spec :family (car font))) + (catch :return + (dolist (font fonts) + (when (find-font (font-spec :family (car font))) (apply #'set-face-attribute `(,face nil :family ,(car font) - ,@(cdr font)))))) + ,@(cdr font))) + (throw :return font))))) (defun acdw/setup-fonts () "Setup fonts. This has to happen after the frame is setup for @@ -462,21 +458,21 @@ from [[https://github.com/link0ff/emacs-init][link0ff]]. (set-face-from-alternatives 'fixed-pitch '(("Libertinus Mono" - :height 1.0) + :height 110) ("Linux Libertine Mono O" - :height 1.0) + :height 110) ("Go Mono" - :height 1.0) + :height 100) ("Consolas" - :height 1.0))) + :height 100))) (set-face-from-alternatives 'variable-pitch '(("Libertinus Serif" - :height 1.0) + :height 120) ("Linux Libertine O" - :height 1.0) + :height 120) ("Georgia" - :height 1.0))) + :height 110))) (remove-function after-focus-change-function #'acdw/setup-fonts))) -- cgit 1.4.1-21-gabe81