Skip to content

Commit

Permalink
org-babel-expand-body:julia: export colons when vars are assigned
Browse files Browse the repository at this point in the history
Fix issue #12
  • Loading branch information
nixo committed Sep 17, 2021
1 parent c0017ff commit cd258ab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ob-julia.el
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,18 @@ Please submit a bug report!")
"Expand BODY according to PARAMS. Return the expanded body, a
string containing the julia we need to evaluate, possibly
wrapped in a let block with variable assignmenetns."
(let ((block (and (alist-get :let params) "let"))
(vars (mapconcat
'concat (org-babel-variable-assignments:julia params) ";")))
(let* ((block (and (alist-get :let params) "let"))
(var-assign (org-babel-variable-assignments:julia params))
(vars
(if var-assign
(concat
(mapconcat
'concat (org-babel-variable-assignments:julia params) ";") "; ")
"")))
(concat
;; no newline between vars and body
;; so that the stacktrace line is aligned
block " " vars "; " body
";\n"
block " " vars body ";\n"
(if block "end\n" ""))))

(defun org-babel-julia-output-file (file &optional extension)
Expand Down

1 comment on commit cd258ab

@ericsfraga
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a git expert: how do I get the fix-issue-12 branch into my system? Sorry for n00b question... (but the code looks reasonable although I wonder why the final ; is required on line 278? I seldom use semi-colons in my Julia code!

Please sign in to comment.