diff options
author | Case Duckworth | 2020-12-22 00:14:58 -0600 |
---|---|---|
committer | Case Duckworth | 2020-12-22 00:17:03 -0600 |
commit | 705e8d4b7b3dfc0e70fe634d223ceea81661de1e (patch) | |
tree | adc266671b9d76c5fefa6396c4190135217e43d3 | |
parent | Update README (diff) | |
download | emacs-705e8d4b7b3dfc0e70fe634d223ceea81661de1e.tar.gz emacs-705e8d4b7b3dfc0e70fe634d223ceea81661de1e.zip |
Correct set-face-from-alternatives function
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | 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). | |||
398 | 398 | ||
399 | 1. Define fonts | 399 | 1. Define fonts |
400 | 400 | ||
401 | (defun font-candidate (&rest fonts) | ||
402 | (catch :font | ||
403 | (dolist (font fonts) | ||
404 | (if (find-font (font-spec :name font)) | ||
405 | (throw :font font))))) | ||
406 | |||
407 | (defun set-face-from-alternatives (face fonts) | 401 | (defun set-face-from-alternatives (face fonts) |
408 | (dolist (font fonts) | 402 | (catch :return |
409 | (if (find-font (font-spec :family (car font))) | 403 | (dolist (font fonts) |
404 | (when (find-font (font-spec :family (car font))) | ||
410 | (apply #'set-face-attribute `(,face nil | 405 | (apply #'set-face-attribute `(,face nil |
411 | :family ,(car font) | 406 | :family ,(car font) |
412 | ,@(cdr font)))))) | 407 | ,@(cdr font))) |
408 | (throw :return font))))) | ||
413 | 409 | ||
414 | (defun acdw/setup-fonts () | 410 | (defun acdw/setup-fonts () |
415 | "Setup fonts. This has to happen after the frame is setup for | 411 | "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 @@ | |||
4 | #+EXPORT_FILE_NAME: README.md | 4 | #+EXPORT_FILE_NAME: README.md |
5 | #+OPTIONS: toc:nil | 5 | #+OPTIONS: toc:nil |
6 | #+BANKRUPTCY_COUNT: 3 | 6 | #+BANKRUPTCY_COUNT: 3 |
7 | #+Time-stamp: <2020-12-21 17:20:22 aduckworth> | 7 | #+Time-stamp: <2020-12-22 00:16:24 acdw> |
8 | 8 | ||
9 | Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | 9 | Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. |
10 | 10 | ||
@@ -431,18 +431,14 @@ from [[https://github.com/link0ff/emacs-init][link0ff]]. | |||
431 | **** Define fonts | 431 | **** Define fonts |
432 | 432 | ||
433 | #+begin_src emacs-lisp | 433 | #+begin_src emacs-lisp |
434 | (defun font-candidate (&rest fonts) | ||
435 | (catch :font | ||
436 | (dolist (font fonts) | ||
437 | (if (find-font (font-spec :name font)) | ||
438 | (throw :font font))))) | ||
439 | |||
440 | (defun set-face-from-alternatives (face fonts) | 434 | (defun set-face-from-alternatives (face fonts) |
441 | (dolist (font fonts) | 435 | (catch :return |
442 | (if (find-font (font-spec :family (car font))) | 436 | (dolist (font fonts) |
437 | (when (find-font (font-spec :family (car font))) | ||
443 | (apply #'set-face-attribute `(,face nil | 438 | (apply #'set-face-attribute `(,face nil |
444 | :family ,(car font) | 439 | :family ,(car font) |
445 | ,@(cdr font)))))) | 440 | ,@(cdr font))) |
441 | (throw :return font))))) | ||
446 | 442 | ||
447 | (defun acdw/setup-fonts () | 443 | (defun acdw/setup-fonts () |
448 | "Setup fonts. This has to happen after the frame is setup for | 444 | "Setup fonts. This has to happen after the frame is setup for |
@@ -462,21 +458,21 @@ from [[https://github.com/link0ff/emacs-init][link0ff]]. | |||
462 | 458 | ||
463 | (set-face-from-alternatives 'fixed-pitch | 459 | (set-face-from-alternatives 'fixed-pitch |
464 | '(("Libertinus Mono" | 460 | '(("Libertinus Mono" |
465 | :height 1.0) | 461 | :height 110) |
466 | ("Linux Libertine Mono O" | 462 | ("Linux Libertine Mono O" |
467 | :height 1.0) | 463 | :height 110) |
468 | ("Go Mono" | 464 | ("Go Mono" |
469 | :height 1.0) | 465 | :height 100) |
470 | ("Consolas" | 466 | ("Consolas" |
471 | :height 1.0))) | 467 | :height 100))) |
472 | 468 | ||
473 | (set-face-from-alternatives 'variable-pitch | 469 | (set-face-from-alternatives 'variable-pitch |
474 | '(("Libertinus Serif" | 470 | '(("Libertinus Serif" |
475 | :height 1.0) | 471 | :height 120) |
476 | ("Linux Libertine O" | 472 | ("Linux Libertine O" |
477 | :height 1.0) | 473 | :height 120) |
478 | ("Georgia" | 474 | ("Georgia" |
479 | :height 1.0))) | 475 | :height 110))) |
480 | 476 | ||
481 | (remove-function after-focus-change-function #'acdw/setup-fonts))) | 477 | (remove-function after-focus-change-function #'acdw/setup-fonts))) |
482 | 478 | ||