gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
231 stars 21 forks source link

problem when exporting org-mode file with source block #99

Closed dahtah closed 1 year ago

dahtah commented 2 years ago

I'm having trouble getting the new org-babel support to work properly. Evaluating code blocks works but exporting results doesn't. MRE: initialise a test.org file with

-*- julia-snail-extensions: (ob-julia) -*- 

#+begin_src julia :exports both
a = "abc"
#+end_src

save, reload to add ob-julia extension, then M-x julia-snail, followed by org-beamer-export-to-pdf (NB: same problem appears with html export). Export fails with an error, trace is

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (let ((out (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents out-file) (let ... ...)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (puthash (current-thread) (copy-marker (point)) julia-snail/ob-julia--point-finals) (goto-char (gethash (current-thread) julia-snail/ob-julia--point-inits)) out)
  (let ((src-file (concat (org-babel-temp-file "julia-src-") ".jl")) (out-file (org-babel-temp-file "julia-out-")) (module (let ((maybe-module (cdr (assq :module params)))) (if maybe-module maybe-module "Main")))) (let ((temp-file src-file) (temp-buffer (generate-new-buffer " *temp file*"))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert body)) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (julia-snail/ob-julia-evaluate module body src-file out-file) (let ((out (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...)))))) (puthash (current-thread) (copy-marker (point)) julia-snail/ob-julia--point-finals) (goto-char (gethash (current-thread) julia-snail/ob-julia--point-inits)) out))
  org-babel-execute:julia("a = \"abc\"" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "both") (:cache . "no") (:hlines . "no") (:module . "Main") (:noweb . "no") (:session . "none") (:tangle . "no") (:wrap)))
gcv commented 2 years ago

@MasonProtter: What do you think?

kiranshila commented 2 years ago

I am also getting this isssue

MasonProtter commented 1 year ago

Sorry for the late response, I was away. Think #106 should fix this.

gcv commented 1 year ago

Thanks, @MasonProtter! @dahtah, @kiranshila: Could you please check that this works for you now (and reopen the ticket if necessary)?