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.
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.
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):
org-modeusers, there is even completion in the
org-modebuffer 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 https://github.com/NightMachinary/doom.d . 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
K in normal-mode on any symbol shows its docs. Autocompletion works by just typing:
<sj and pressing TAB will insert a Julia cell with
jupyter-julia :session j1 filled in.