mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-22 07:09:47 +00:00
org-babel-expand-body:scheme: define header arg vars using define
* ob-scheme.el (org-babel-expand-body:scheme, org-babel-expand-header-arg-vars:scheme): Change the way header argument :var variables are expanded for for Scheme source blocks. Use `define' instead of wrapping using `let'. Wrapping binding definitions using `let' can lead to issues with GNU Guile and potentially other Scheme dialects. GNU Guile will only get to the body of the let at evaluation time, not at macro expansion time. If the let form wraps any imports of libraries that define macros, then those imported macros are seen too late and their corresponding forms inside the body of the let are not expanded. Using `define' to define bindings avoids this problem, at least in GNU Guile. For more context see the mailing list discussion at: https://lists.gnu.org/archive/html/emacs-orgmode/2023-03/msg00087.html TINYCHANGE
This commit is contained in:
parent
e065b53a4a
commit
d97ba5ba52
@ -79,6 +79,14 @@
|
||||
(defvar org-babel-default-header-args:scheme '()
|
||||
"Default header arguments for scheme code blocks.")
|
||||
|
||||
(defun org-babel-scheme-expand-header-arg-vars (vars)
|
||||
"Expand :var header arguments given as VARS."
|
||||
(mapconcat
|
||||
(lambda (var)
|
||||
(format "(define %S %S)" (car var) (cdr var)))
|
||||
vars
|
||||
"\n"))
|
||||
|
||||
(defun org-babel-expand-body:scheme (body params)
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
(let ((vars (org-babel--get-vars params))
|
||||
@ -86,13 +94,7 @@
|
||||
(postpends (cdr (assq :epilogue params))))
|
||||
(concat (and prepends (concat prepends "\n"))
|
||||
(if (null vars) body
|
||||
(format "(let (%s)\n%s\n)"
|
||||
(mapconcat
|
||||
(lambda (var)
|
||||
(format "%S" (print `(,(car var) ',(cdr var)))))
|
||||
vars
|
||||
"\n ")
|
||||
body))
|
||||
(concat (org-babel-scheme-expand-header-arg-vars vars) "\n" body))
|
||||
(and postpends (concat "\n" postpends)))))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user