Do you put it in your init.el?
@gcv Snail is great! Thanks a lot.
I am wondering if Snail can check variable/function names and underline them if the definition is not found, like eglot
. This is probably the main reason I need eglot, even though the startup time is long. Really hope this can be done with Snail.
@PetrKryslUCSD Yes, I put (setq eglot-connet-timeout 180)
in my init.el.
No, I mean eglot-jl-init…
@PetrKryslUCSD Yes, I also put (eglot-jl-init)
in my init file.
It can be done, but should really happen after Snail switches from CSTParser to tree-sitter or JuliaSyntax. I added a ticket for your feature request. It’ll definitely take me a while to find time to work on it.
Julia Snail is very nice indeed!
julia> methods(sin)
# 14 methods for generic function "sin" from Base:
[1] sin(::Irrational{:π})
@ Base.MathConstants mathconstants.jl:126
[2] sin(::Missing)
@ Base.Math math.jl:1580
[3] sin(a::Float16)
@ Base.Math math.jl:1558
[4] sin(x::BigFloat)
@ Base.MPFR mpfr.jl:801
See those numbers? If you have JULIA_EDITOR configured (eg. to emacs-client), and press 2
then Ctrl-q
, it opens the editor on that line of that file, and grants you five extra lives. It’s the Konami-code of the Julia REPL.
C-q
I had no idea this existed. I ran into 2 little problems that were easily solved.
- It used the environment variable
VISUAL
instead ofEDITOR
for me. - I had my
VISUAL
set toemacsclient -f
so that it would open a new Emacs frame instead of reusing an existing one, and the way julia invoked it didn’t work. I had to changeVISUAL
back to justemacsclient
, and then it worked.
PS: Where is this C-q feature documented?
UPDATE: 2024-12-12: I missed that you used the JULIA_EDITOR
environment variable. I’d like to keep the value of VISUAL
to emacsclient -f
, so it’s nice that I can use JULIA_EDITOR
in a Julia-specific way.
C-q
documentation here:
^Q
Write a number in REPL and press^Q
to open editor at corresponding stackframe or method
It works great for opening source files at a numbered location in a stack trace, when you encounter errors.
Skimming through the list of keybindings, you can tell the Julia REPL was designed by an Emacs user. It’s funny seeing words like kill and yank used outside of Emacs.
Update concerning a Julia REPL in Emacs 29.1.4 running in WSL 2:
-
Julia Snail is very nice indeed. I did not get to use the remote capability, so I can’t comment. I’m not sure how I feel about the ability to evaluate code within a module. Maybe I’m just not used to it.
Unfortunately, clicking on errors in the*julia* error
buffer only works at the top.
Error links such as the one on line 6 open a dialogue asking for a path.
-
julia-repl is great! I like that everything is in the command window, and the links to errors are clickable.
Both of the above were used with julia-mode. I haven’t tried out treesitter yet.
Edit: Also, both used with vterm. The only thing that needed a bit of tweaking was copying from the vterm window. But it works great overall.
Edit 2: Links in the error messages from Julia Snail are not clickable.
Thank you, @gcv, for saving us from this. I’m thankful that I can move between multiple Julia projects with ease using a single Emacs instance.
My first thought was that practically everyone uses Revise now. However, I just discovered a case where this module-aware feature is still useful.
Apparently, Revise doesn’t notice when I modify a macro in a module. I modified a few other random things in the module to verify Revise was otherwise working, and it was. However, changes to a macro were never picked up. I needed to julia-snail-send-dwim
while my cursor was in the macro code to get the REPL to get the latest macro code.
That’d be this issue, maybe? Changes to macros are ignored · Issue #20 · timholy/Revise.jl
I run my Julia REPLs in shell buffers. If you give Meta-x shell
a numeric argument it will prompt you for a new buffer name. I typically have a shell buffer for each project I’m currently wrking on.
That’s a clever way to do it. Do you also have a way to send Julia code to these various shell buffers? (I did a little investigation before posting, and I found the comint-send-string
function which could be used for this, but it seems like you’d have to write your own interactive function that wraps it …unless I missed something which is very possible.)
Nothing clever, just Meta-w from one buffer and Ctrl-y in the other.
Maybe you could give isend
a try; it’s purpose is exactly this: send code from a buffer to a terminal. In a way that’s configurable enough to work the same for multiple types of interpreters (shell
, [i]python
, julia
…) and multiple types of terminals (ansi-term
, vterm
…). It does not have specific code for shell
but I just tested and it seems to work.
Disclaimer: I’m the author of this library
Long time julia-repl
user here, I just wanted to add that it is totally possible to use multiple repls in julia-repl
!
The idea is that you can define a repl suffix, and the code gets send to the repl buffer with the corresponding suffix. Thus it is possible to have *julia-project1*
and *julia-project2*
repls. And since emacs is emacs you can obviously automate this by defining function advice, using project load hooks and so on.