From fb01362a9dd816fc0d0e50052ab4764dd30e46f3 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Thu, 1 May 2025 17:06:41 -0400 Subject: You know we love updating with a horrendous commit message --- src/gizmo/wasp-bless.el | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src/gizmo/wasp-bless.el') diff --git a/src/gizmo/wasp-bless.el b/src/gizmo/wasp-bless.el index 109b2f35..c3175548 100644 --- a/src/gizmo/wasp-bless.el +++ b/src/gizmo/wasp-bless.el @@ -22,21 +22,21 @@ "Construct an Emacs Lisp value representation of the value J." (let ((tag (alist-get 'tag j))) (cond - ((s-equals? tag "ValueInteger") (alist-get 'contents j)) - ((s-equals? tag "ValueArray") - (-map #'w/bless-parse-value (alist-get 'contents j))) - (t (message "Unknown Bless tag: %s" tag))))) + ((s-equals? tag "ValueInteger") (alist-get 'contents j)) + ((s-equals? tag "ValueArray") + (-map #'w/bless-parse-value (alist-get 'contents j))) + (t (message "Unknown Bless tag: %s" tag))))) (defun w/bless-parse-effect (j) "Construct an Emacs Lisp value representation of the effect J." (let ((tag (alist-get 'tag j)) - (c (alist-get 'contents j))) - (cond - ((s-equals? tag "EffectPrint") `(print ,(w/bless-parse-value c))) - ((s-equals? tag "EffectPrintBackwards") `(print-backwards ,(w/bless-parse-value c))) - ((s-equals? tag "EffectSoundboard") `(soundboard ,(w/bless-parse-value c))) - ((s-equals? tag "EffectModelToggle") `(model-toggle ,(w/bless-parse-value c))) - ))) + (c (alist-get 'contents j))) + (cond + ((s-equals? tag "EffectPrint") `(print ,(w/bless-parse-value c))) + ((s-equals? tag "EffectPrintBackwards") `(print-backwards ,(w/bless-parse-value c))) + ((s-equals? tag "EffectSoundboard") `(soundboard ,(w/bless-parse-value c))) + ((s-equals? tag "EffectModelToggle") `(model-toggle ,(w/bless-parse-value c))) + ))) (defun w/bless-parse-stack (j) "Construct an Emacs Lisp value representation of the stack J." @@ -63,32 +63,32 @@ Optionally limit evaluation to FUEL steps." (with-current-buffer buf (erase-buffer)) (make-process - :name "wasp-bless-eval" - :buffer buf - :command `("bless" "-j" "eval" ,@(if fuel (list "--fuel" (number-to-string fuel)) nil) ,str) - :sentinel - (lambda (_ _) - (let* ((s (with-current-buffer buf (buffer-string))) - (j (json-read-from-string s)) - (status (alist-get 'status j))) - (kill-buffer buf) - (if (s-equals? status "success") - (funcall + :name "wasp-bless-eval" + :buffer buf + :command `("bless" "-j" "eval" ,@(if fuel (list "--fuel" (number-to-string fuel)) nil) ,str) + :sentinel + (lambda (_ _) + (let* ((s (with-current-buffer buf (buffer-string))) + (j (json-read-from-string s)) + (status (alist-get 'status j))) + (kill-buffer buf) + (if (s-equals? status "success") + (funcall k (cons - (w/bless-parse-stack (alist-get 'stack (alist-get 'data j))) - (w/bless-parse-effects (alist-get 'effects (alist-get 'data j))))) - (w/bless-error (alist-get 'data j)))))))) + (w/bless-parse-stack (alist-get 'stack (alist-get 'data j))) + (w/bless-parse-effects (alist-get 'effects (alist-get 'data j))))) + (w/bless-error (alist-get 'data j)))))))) (defun w/bless (str &optional fuel) "Run the Bless program STR and apply its side effects. Optionally limit evaluation to FUEL steps." (w/bless-eval - str - (lambda (res) - (--each (cdr res) - (w/bless-apply-effect it))) - fuel)) + str + (lambda (res) + (--each (cdr res) + (w/bless-apply-effect it))) + fuel)) (provide 'wasp-bless) ;;; wasp-bless.el ends here -- cgit v1.2.3