Can you write a post on your setup? (Your emacs config for it, an example notebook or two, a videocast perhaps) It sounds wonderful.
I use a pretty similar setup with emacs-jupyter and org notebooks for everything (that doesnât need to be reusable as a julia package). Configuration is basically nonexistent. If Mason doesnât have any readily available examples, Iâll take a look around my org directory and see if any are suitable for public consumption.
I played around with emacs-jupyter. I can get the completion to work on normal Julia buffers by calling eglot
(though ithe completion system is still somewhat buggy and sometimes doesnât work):
but the completion is incomplete in the special buffers of org babel:
I think eglot will never work with editing source code that isnât directly linked to a specific julia file due to the limitations of how the language server protocol works:
I donât know how the new notebook interface works to be honest. They might be doing something custom or hooking into endpoints of the language server that arenât part of the specification.
emacs-jupyter provides also its own completion by querying the jupyter kernel (or something like this). For me completion in the special buffer works when I use only emacs-jupyter without eglot running (Edit: actually it works for me also when eglot is running)
Can you try to disable eglot and then call completion-at-point in the special buffer?
Have you tried my specific example (trying to complete a function imported via âusing xâ)? There is some completion support, but it is very incomplete.
yes
Just to clarify because it is not clear from your screenshot, did you first run the block with using Distrbutions
before trying to get completions? If Distributions
was not loaded in the kernel yet you would not get completion (same as in a Jupyter notebook or the REPL).
Here is my config https://github.com/MasonProtter/.emacs.d, but itâs not really the best for sharing widely; itâs pretty adapted to my specific machines, needs and workflows.
I can try to make a trimmed down âstarterâ version of it though and then perhaps a little videocast of me using my âscrap notebooksâ.
No guarantees Iâll get around to this anytime soon though, Iâm a pretty egregious procrastinator.
You should update julia-mode
. Itâs had a number of bugs fixed since 2017.
Right, I should have said, the only files in there actually worth looking at is myinit.org and I guess init.el if one wants to know how I use a org file for the config.
The rest is junk I pushed to the repo years ago when I was still learning to use git and now regret doing so, but not enough to actually remove it.
Youâre right. Is there a way to get the completions in the normal org buffer, without opening the special buffers?
For me completion works also in the org buffer inside the source-code block.
According to emacs-jupyterâs README I think it should just work (but maybe Iâm missing something):
For
org-mode
users, there is even completion in theorg-mode
buffer when editing the contents of a Jupyter source code block.
If you do M-x completion-at-point
inside the source code block, does it work?
I needed to set company-backends to company-capf and then things work!
Is there a way to use several company backends together? I also like to have dabbrev-code âŚ
Iâm not an expert on company-mode, but it seems that you can define multiple backends in compny-backends
. Iâm not sure exactly how those different backends interact with each-other and how it is determined which one is called, try reading the documentation of that variable.
I think you could also define different backends for different modes via mode hooks since company-backends
is a buffer-local variable.
As someone fairly new to emacs (just got Prelude up-and-running, not familiar with company mode or org mode), would be great if someone could put together just a basic guide to getting julia support working. I was able to install julia-mode to get syntax highlight w/ no problem, and also to launch an repl with julia-repl, but beyond that I am not really sure which way to go
What features are you looking for? I think julia-mode + julia-repl is basically the basic setup.
For code completion in source files you can take a look at eglot-jl or julia-snail.
For interactive notebook like experience take a look at emacs-jupyter.
If you have specific problems feel free to ask.
Copy my doom config from GitHub - NightMachinery/doom.d: My somewhat modular emacs config. . You also need doom installed.
You need IJulia installed in your Julia environment.
Then you can put this in an .org file and press âCtrl-c Ctrl-câ to run the code:
#+begin_src jupyter-julia :session j1
println(8)
#+end_src
Pressing K
in normal-mode on any symbol shows its docs. Autocompletion works by just typing:
Typing <sj
and pressing TAB will insert a Julia cell with jupyter-julia :session j1
filled in.