branch: externals/modus-themes
commit 7a86cf49a8de93809f948b3647b0548ae35ed7cc
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Revise modus-themes-with-colors to work with dynamic variables
This is how it used to be. I am addressing a regression that was
introduced in Modus themes version 5.0.0.
Thanks to Alexandr Semenov and realazy for testing my patch in issue
170: <https://github.com/protesilaos/modus-themes/issues/170>.
---
modus-themes.el | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/modus-themes.el b/modus-themes.el
index dfcbb8f147..302d6c92e1 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -7471,23 +7471,23 @@ whose value is another symbol, which ultimately
resolves to a string or
(semantic-unique (funcall unique-fn semantic)))
(nreverse (nconc semantic-unique named-unique)))))
-(defun modus-themes-with-colors-subr (expressions)
- "Do the work of `modus-themes-with-colors' for EXPRESSIONS."
+(defun modus-themes-with-colors-subr (body)
+ "Do the work of `modus-themes-with-colors' for BODY."
(condition-case data
- (when-let* ((theme (modus-themes-get-current-theme)))
+ (when-let* ((modus-themes-with-colors--current
(modus-themes-get-current-theme))
+ (palette (modus-themes--with-colors-get-palette
modus-themes-with-colors--current))
+ (sorted (modus-themes--with-colors-resolve-palette-sort
palette)))
(eval
`(let* ((c '((class color) (min-colors 256)))
(unspecified 'unspecified)
- ,@(modus-themes--with-colors-resolve-palette-sort
- (modus-themes--with-colors-get-palette theme)))
- ,@expressions)
- :lexical))
+ ,@sorted)
+ (funcall ',body))))
(error (message "Error in `modus-themes-with-colors': %s" data))))
(defmacro modus-themes-with-colors (&rest body)
"Evaluate BODY with colors from current palette bound."
(declare (indent 0))
- `(modus-themes-with-colors-subr ',body))
+ `(modus-themes-with-colors-subr (lambda () ,@body)))
;;;; Declare all the Modus themes