[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/autothemer d7d0d4c233 1/3: 0.2.4 - fixes #20
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/autothemer d7d0d4c233 1/3: 0.2.4 - fixes #20 |
Date: |
Tue, 9 Aug 2022 05:58:18 -0400 (EDT) |
branch: elpa/autothemer
commit d7d0d4c233fc4672062878e647be08ccb81c6bd6
Author: Jason Milkins <jasonm23@gmail.com>
Commit: Jason Milkins <jasonm23@gmail.com>
0.2.4 - fixes #20
When generating face specs, faces with attributes expressed as cons
cells throw an error. (cond was expecting a symbol as it's final
clause)
Fixed by adding a clause to quote cons cells.
---
autothemer.el | 39 +++++++++++++++++++++++----------------
tests/theme-example.el | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 16 deletions(-)
diff --git a/autothemer.el b/autothemer.el
index ced4c6880e..4eb309b4b3 100644
--- a/autothemer.el
+++ b/autothemer.el
@@ -1,11 +1,14 @@
;;; autothemer.el --- Conveniently define themes. -*- lexical-binding: t -*-
-
+;;
+;;; Author: Sebastian Sturm
+;;
;; Copyright 2015-2022 Sebastian Sturm
-
-;; Author: Sebastian Sturm
-;; URL: https://github.com/sebastiansturm/autothemer
-;; Version: 0.2.3
-;; Package-Requires: ((dash "2.10.0") (emacs "24") (cl-lib "0.5"))
+;;
+;;; Maintainer: Jason Milkins <jasonm23@gmail.com>
+;;
+;;; URL: https://github.com/jasonm23/autothemer
+;;; Version: 0.2.4
+;;; Package-Requires: ((dash "2.10.0") (emacs "24") (cl-lib "0.5"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -108,8 +111,7 @@ bindings within both the REDUCED-SPECS and the BODY."
(list
',(autothemer--extract-display palette n)
,(autothemer--demote-heads
(elt it 1))))
- reduced-specs))
- ))))
+ reduced-specs))))))
(apply #'custom-theme-set-faces ',name
(cl-loop for ,temp-n from 0 to ,(1- n-faces)
collect (list (elt ',face-names ,temp-n)
@@ -183,6 +185,7 @@ unbound symbols, such as `normal' or `demibold'."
((stringp it) it)
((numberp it) it)
((facep it) `(quote ,it))
+ ((consp it) `(quote ,it))
((not (boundp it)) `(quote ,it))
(t it))
spec))))
@@ -215,7 +218,7 @@ unbound symbols, such as `normal' or `demibold'."
(elt (car palette) n))
(defun autothemer--extract-let-block (palette n)
- "Extract a variable definition block from PALETTE containing all color
definitions corresponding to display type #N."
+ "Extract a variable definition block from PALETTE for display type N."
(cl-loop for row in (cdr palette)
collect (list (car row) (elt row (1+ n)))))
@@ -229,13 +232,17 @@ approximate the faces' current definitions using the color
palette used in the most recent invocation of
`autothemer-deftheme'."
(interactive)
- (let* ((missing-faces (autothemer--unthemed-faces))
- (templates (--map (autothemer--approximate-spec
- (autothemer--alist-to-reduced-spec
- it (autothemer--face-to-alist it))
- autothemer--current-theme)
- missing-faces))
- (buffer (get-buffer-create (generate-new-buffer-name "*Autothemer:
unthemed faces*"))))
+ (let* ((missing-faces
+ (autothemer--unthemed-faces))
+ (templates
+ (--map (autothemer--approximate-spec
+ (autothemer--alist-to-reduced-spec
+ it (autothemer--face-to-alist it))
+ autothemer--current-theme)
+ missing-faces))
+ (buffer
+ (get-buffer-create
+ (generate-new-buffer-name "*Autothemer: unthemed faces*"))))
(with-current-buffer buffer (emacs-lisp-mode) (insert (pp templates)))
(switch-to-buffer buffer)))
diff --git a/tests/theme-example.el b/tests/theme-example.el
new file mode 100644
index 0000000000..5699122967
--- /dev/null
+++ b/tests/theme-example.el
@@ -0,0 +1,43 @@
+;; theme-example.el
+
+;;; Code:
+
+(load-file "autothemer.el")
+
+(autothemer-deftheme
+ theme-example
+ "Autothemer example..."
+
+ ;; Specify the color classes used by the theme
+ ((((class color) (min-colors #xFFFFFF))
+ ((class color) (min-colors #xFF)))
+
+ ;; Specify the color palette for each of the classes above.
+ (example-red "#781210" "#FF0000")
+ (example-green "#22881F" "#00D700")
+ (example-blue "#212288" "#0000FF")
+ (example-purple "#812FFF" "#Af00FF")
+ (example-yellow "#EFFE00" "#FFFF00")
+ (example-orange "#E06500" "#FF6600")
+ (example-cyan "#22DDFF" "#00FFFF"))
+
+ ;; specifications for Emacs faces.
+ ((button (:underline t :weight 'bold :foreground example-yellow))
+ (error (:foreground example-red)))
+
+ ;; Forms after the face specifications are evaluated.
+ ;; (palette vars can be used, read below for details.)
+ (custom-theme-set-variables
+ 'theme-example
+ `(ansi-color-names-vector
+ [,example-red
+ ,example-green
+ ,example-blue
+ ,example-purple
+ ,example-yellow
+ ,example-orange
+ ,example-cyan])))
+
+;; Eval buffer and use as a test sandox.
+
+;;; theme-example.el ends here