Expand the CRITICAL FIXME for modus-themes-with-colors with the failed macro+function test I did

I tried a few variations of that function, but the point is that I
cannot make the macro work inside of a function that is evaluated at
startup in a user's init file. The same function works after I go and
evaluate it manually.

I stumbled across 'define-inline' while looking around in the Emacs
source code, but I am not sure this is what I need... Will need to
test further.
This commit is contained in:
Protesilaos Stavrou 2025-11-04 05:07:39 +02:00
parent 5e77bff62e
commit 4514036961
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -7336,6 +7336,30 @@ Consult the manual for details on how to build a theme on top of the
;;
;; - Have a function that does the actual work of binding the palette and evaluating BODY.
;; - Make the macro simply set up the function to evaluate BODY.
;;
;; HOWEVER, doing the following leads to excessive lisp nesting errors
;; at startup when the `modus-themes-with-colors' is inside of a
;; function. If we evaluate the function after the themes are loaded,
;; then everything works as expected;
;;
;; (defun modus-themes-with-colors-subr (expressions)
;; "Do the work of `modus-themes-with-colors' for EXPRESSIONS."
;; (when-let* ((theme (modus-themes-get-current-theme))
;; (palette (modus-themes--get-theme-palette-subr theme :with-overrides :with-user-palette)))
;; (eval
;; `(let* ((c '((class color) (min-colors 256)))
;; (palette ',palette)
;; ,@(mapcar
;; (lambda (entry)
;; (let ((name (car entry)))
;; (list name `(modus-themes--retrieve-palette-value ',name palette))))
;; palette))
;; ,@expressions))))
;;
;; (defmacro modus-themes-with-colors (&rest body)
;; "Evaluate BODY with colors from current palette bound."
;; (declare (indent 0))
;; `(modus-themes-with-colors-subr ',body))
(defmacro modus-themes-with-colors (&rest body)
"Evaluate BODY with colors from current palette bound."
(declare (indent 0))