gjkerns / ob-julia

36 stars 25 forks source link

ess-julia-mode, julia-mode and org-mode configuration #19

Open fkgruber opened 3 years ago

fkgruber commented 3 years ago

Hi I'm running into a strange issue when using julia with orgmode. I loaded ob-julia (load-file "~/elisp/ob-julia.el") and included julia in the load-language

(org-babel-do-load-languages
 'org-babel-load-languages
 '((julia . t)))

I'm able to create a source block and execute it with C-c C-c

#+begin_src julia
x="foo2"
y=[1,2,3,4,5]
y
#+end_src

However, when I try to edit the code (C-c ') julia-mode is activated and none of the ESS specific commands work.

On the other hand if I use ess-julia instead of julia on the source block:

#+begin_src ess-julia
x="foo2"
y=[1,2,3,4,5]
y
#+end_src

and I type C-c ' then ess-julia-mode gets activated and the ess keybindinds work fine.

The problem is that with ess-julia-mode I'm unable to use C-c C-c to execute the block. I get: org-babel-execute-src-block: No org-babel-execute function for ess-julia!

How can I set org-edit-src-code to set julia blocks to ess-julia-mode instead of julia-mode? Or alternatively use ess-julia as an alias to julia so that I can execute julia blocks in orgmode.

Could this be related to issue: https://github.com/emacs-ess/ESS/issues/645 ?

What am I missing? thanks FKG

frederic-santos commented 3 years ago

Hi,

This package is not maintained anymore, so it is not useful to post here. Several forks are available: https://git.nixo.xyz/nixo/ob-julia or https://github.com/frederic-santos/ob-ess-julia

Actually, your problem is the expected behavior. I suppose that you use polymode. Polymode has an automatic matcher: if the src block begins with begin src python, then its inner content is matched to python-mode; if the src block begins with begin src julia, then it is matched to julia-mode by default, etc. And indeed, you have no access to ESS features with julia-mode (especially, no auto-completion).

Your idea was good: if your src block begins with begin src ess-julia, then it is matched to ess-julia-mode, which is want you want. But also, still by default, org-babel searches for an executable which has the same name, ess-julia, and obviously does not find one. Thus, everything works as expected. :wink:

For the fork I'm maintaining, I'm currently struggling with this same question. There are several difficult choices to make, and I'm still not sure which one is the best. Currently, I use only julia-mode as the innermode of code chunks, but it might change for ess-julia-mode soon (thus offering what you want).

Cheers, F.

fkgruber commented 3 years ago

Hi F. I will try your fork. I'm glad to know that there are other people taking over this...

I was not using polymode. I simply want to be able to use org-edit-src-code (C-c ' ) to get into ess-julia-mode so I can edit stuff. But for some reason it is using julia-mode instead. weird.

I do most of my work on R and would love to have the exact same workflow with Julia.

Hi,

This package is not maintained anymore, so it is not useful to post here. Several forks are available: https://git.nixo.xyz/nixo/ob-julia or https://github.com/frederic-santos/ob-julia

Actually, your problem is the expected behavior. I suppose that you use polymode. Polymode has an automatic matcher: if the src block begins with begin src python, then its inner content is matched to python-mode; if the src block begins with begin src julia, then it is matched to julia-mode by default, etc. And indeed, you have no access to ESS features with julia-mode (especially, no auto-completion).

Your idea was good: if your src block begins with begin src ess-julia, then it is matched to ess-julia-mode, which is want you want. But also, still by default, org-babel searches for an executable which has the same name, ess-julia, and obviously does not find one. Thus, everything works as expected. 😉

For the fork I'm maintaining, I'm currently struggling with this same question. There are several difficult choices to make, and I'm still not sure which one is the best. Currently, I use only julia-mode as the innermode of code chunks, but it might change for ess-julia-mode soon (thus offering what you want).

Cheers, F.

frederic-santos commented 3 years ago

I do most of my work on R and would love to have the exact same workflow with Julia.

Actually I'm in the same situation and that's why I'm trying to develop a fork of ob-julia :wink: My fork might change heavily within the next few days (even its name should change...). Partly due to the issue you raised here, the package will probably be renamed ob-ess-julia. It might be better to wait a few more days before trying it. But thanks!