branch: externals/modus-themes
commit 95dde90c8482f6c40103da4997773451bf91f13d
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Reorder the forms in the macro to put the let closer to where it is needed
---
modus-themes.el | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/modus-themes.el b/modus-themes.el
index 848963d302..d5e37bcd90 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -4443,16 +4443,29 @@ Optional OVERRIDES are appended to PALETTE, overriding
corresponding entries."
(declare (indent 0))
(let ((sym (gensym))
- (colors (mapcar #'car (symbol-value palette))))
- `(let* ((c '((class color) (min-colors 256)))
- (,sym (modus-themes--palette-value ',name ',overrides))
- ,@(mapcar (lambda (color)
- (list color
- `(modus-themes--retrieve-palette-value ',color
,sym)))
- colors))
- (ignore c ,@colors) ; Silence unused variable warnings
- (custom-theme-set-faces ',name ,@modus-themes-faces)
- (custom-theme-set-variables ',name ,@modus-themes-custom-variables))))
+ (colors (mapcar #'car (symbol-value core-palette)))
+ (theme-exists-p (custom-theme-p name)))
+ `(progn
+ ,@(unless theme-exists-p
+ (list `(custom-declare-theme
+ ',name ',family
+ ,description
+ (list :kind 'color-scheme :background-mode
',background-mode :family ',family
+ :modus-core-palette ',core-palette
:modus-user-palette ',user-palette
+ :modus-overrides-palette ',overrides-palette))))
+ ,@(when user-palette
+ (list `(add-to-list 'modus-themes-registered-items ',name)))
+ (let* ((c '((class color) (min-colors 256)))
+ (,sym (append ,user-palette ,core-palette nil))
+ ,@(mapcar (lambda (color)
+ (list color
+ `(modus-themes--retrieve-palette-value ',color
,sym)))
+ colors))
+ (ignore c ,@colors) ; Silence unused variable warnings
+ (custom-theme-set-faces ',name ,@modus-themes-faces)
+ (custom-theme-set-variables ',name ,@modus-themes-custom-variables)
+ ,@(unless theme-exists-p
+ (list `(provide-theme ',name)))))))
;;;; Use theme colors