# \[ANN\] Julia Snail, an Emacs development environment — first beta release

**URL:** <https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786>\
**Category:** Tooling\
**Tags:** emacs\
**Created:** [March 10, 2020, 6:09am UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786 "2020-03-10T06:09:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcv/32/11086_2.png) [@gcv](https://discourse.julialang.org/u/gcv)\
**Post date:** [March 10, 2020, 6:09am UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/1 "2020-03-10T06:09:01Z")

</div>

I’d like to announce the first beta release of [Julia Snail](https://github.com/gcv/julia-snail), an Emacs development environment for Julia. Snail provides a workflow for Julia similar to that of Common Lisp’s [SLIME](https://common-lisp.net/project/slime/) and Clojure’s [CIDER](https://cider.mx). It enables convenient and dynamic REPL-driven development.

> **[GitHub - gcv/julia-snail: An Emacs development environment for Julia](https://github.com/gcv/julia-snail)**
>
> An Emacs development environment for Julia. Contribute to gcv/julia-snail development by creating an account on GitHub.

Please see the README for details and a short screencast showing off its features.

Looking forward to questions and feedback!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 10, 2020, 9:58am UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/2 "2020-03-10T09:58:48Z")

</div>

This is very nice!

A couple of glitches I noticed:

1. the first `julia-snail` (or C-c C-z) fails with `open-network-stream: make client process failed: Connection refused, :name, julia-process, :buffer, *julia* process, :host, localhost, :service, 10011, :nowait, nil, :tls-parameters, nil`. The second one works fine.

2. activation fails with `julia-snail--send-to-server: Buffer *julia* process has no process`, even though Julia is running fine and I can send stuff (lines etc) to it.

~~Also, I have not yet figured out how to “escape” the buffer capturing navigation so I can copy output from it (cf `term-line-mode`), but this is the first time I am using `vterm`.~~ Found `vterm-copy-mode`, C-c C-t.

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [March 10, 2020, 11:52am UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/3 "2020-03-10T11:52:20Z")

</div>

👍 I think it is great that there are so many possibilities to develop julia from emacs! I will definitely try this one as soon as I can find some time.

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [March 10, 2020, 12:44pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/4 "2020-03-10T12:44:36Z")

</div>

From the README:

> - The Julia interaction side of the Snail server is single-threaded (using `@async` ). This means the interaction locks up while the REPL is working or running code. Unfortunately, Julia as of version 1.3 does not have user-accessible low-level multithreading primitives necessary to implement a truly multi-threaded Snail server.

I’m curious what about `Threads.@spawn` you found insufficient. It works very similarly to `@async`.

In any case, this is very cool. Thanks for sharing.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [March 10, 2020, 4:03pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/5 "2020-03-10T16:03:09Z")

</div>

Has anyone tried on Windows? Does it _work_? I’ve always had trouble with the terminal  
on Windows… Is this different?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 10, 2020, 4:19pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/6 "2020-03-10T16:19:46Z")

</div>

I guess the key question is whether you can get `libvterm` working on Windows. There aren’t many Windows users for Emacs, it may be best if you just try and report back.

---

<div class="post-metadata">

**Author:** ![gcv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcv/32/11086_2.png) [@gcv](https://discourse.julialang.org/u/gcv)\
**Post date:** [March 10, 2020, 5:22pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/7 "2020-03-10T17:22:10Z")

</div>

@Tamas_Papp:  
It looks like the synchronous REPL startup and Snail server initialization didn’t work right, which is a bit surprising. I just committed a workaround. Please update when MELPA picks up the change and let me know if that works.

Since `send-to-server` didn’t work for you, it means you were missing out on most of the cool features!

@non-Jedi:  
I clearly didn’t read the Julia 1.3 release notes carefully enough. Snail started under 1.2 when `Threads.@spawn` didn’t exist. I’ll have to give it a try. Thanks for pointing it out.

@PetrKryslUCSD:  
Yeah, the vterm dependency is pretty gnarly. It’s worth trying to see if it works on Windows, but I honestly doubt it. If interest in this project picks up, it would be great to just do the right thing and reimplement the Julia REPL in Elisp. It’s honestly not even that hard, but too time-consuming for me to commit to right now.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 10, 2020, 5:59pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/9 "2020-03-10T17:59:51Z")

</div>

> [@gcv](#):
>
> reimplement the Julia REPL in Elisp. It’s honestly not even that hard

One advantage of having it work through a terminal is that you automatically keep up with the features of the extra modes (shell, pkg, help, whatever is added in the future).

---

<div class="post-metadata">

**Author:** ![orialb](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@orialb](https://discourse.julialang.org/u/orialb)\
**Post date:** [March 10, 2020, 6:15pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/10 "2020-03-10T18:15:15Z")

</div>

> [@Tamas\_Papp](#):
>
> the first `julia-snail` (or C-c C-z) fails with `open-network-stream: make client process failed: Connection refused, :name, julia-process, :buffer, *julia* process, :host, localhost, :service, 10011, :nowait, nil, :tls-parameters, nil` . The second one works fine.

I also encounter this, @gcv I tried the version with your latest workaround and it doesn’t seem to fix it.

---

<div class="post-metadata">

**Author:** ![gcv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcv/32/11086_2.png) [@gcv](https://discourse.julialang.org/u/gcv)\
**Post date:** [March 10, 2020, 6:17pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/11 "2020-03-10T18:17:59Z")

</div>

> [@Tamas\_Papp](#):
>
> One advantage of having it work through a terminal is that you automatically keep up with the features of the extra modes (shell, pkg, help, whatever is added in the future).

Absolutely right, but the disadvantages are:

- Relying on either the broken Emacs built-in terminal emulator, `term.el`, which has major display glitches and dreadful performance, or on an external library like vterm, which massively complicates the dependency story and probably locks out Windows users.
- Complicates using a REPL running on a remote machine.

It’s just so much more user-friendly to have a native Emacs REPL. With enough interest, I feel that keeping up with Julia REPL features will be a smaller aggregate burden than asking users to deal with a terminal-based solution.

---

<div class="post-metadata">

**Author:** ![gcv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcv/32/11086_2.png) [@gcv](https://discourse.julialang.org/u/gcv)\
**Post date:** [March 10, 2020, 6:21pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/12 "2020-03-10T18:21:06Z")

</div>

> [@orialb](#):
>
> I also encounter this, @gcv I tried the version with your latest workaround and it doesn’t seem to fix it.

There’s something non-obvious going on. Mind opening a ticket on GitHub so we can track and discuss it without derailing this discussion? Also please post your platform info (OS, Emacs distribution, Julia version). If you have any interesting local firewall utilities, or some kind of security software that gets in the way of opening network ports, please include that too.

---

<div class="post-metadata">

**Author:** ![orialb](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@orialb](https://discourse.julialang.org/u/orialb)\
**Post date:** [March 10, 2020, 6:45pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/13 "2020-03-10T18:45:39Z")

</div>

> [@gcv](#):
>
> Mind opening a ticket on GitHub so we can track and discuss it without derailing this discussion?

[done](https://github.com/gcv/julia-snail/issues/2)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 10, 2020, 7:23pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/14 "2020-03-10T19:23:45Z")

</div>

> [@gcv](#):
>
> It’s just so much more user-friendly to have a native Emacs REPL. With enough interest, I feel that keeping up with Julia REPL features will be a smaller aggregate burden than asking users to deal with a terminal-based solution.

I would be happy to contribute if you get something started. I love programming in Julia and I still feel comfortable in (Emacs) Lisp, so from my perspective this would be easier to maintain than a solution involving yet another language or protocol.

---

<div class="post-metadata">

**Author:** ![orialb](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@orialb](https://discourse.julialang.org/u/orialb)\
**Post date:** [March 10, 2020, 8:11pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/15 "2020-03-10T20:11:55Z")

</div>

@Tamas_Papp seems like the issue you and I were encountering is now solved on master, guess it will be good if you also test it when you have time.

---

<div class="post-metadata">

**Author:** ![gcv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcv/32/11086_2.png) [@gcv](https://discourse.julialang.org/u/gcv)\
**Post date:** [March 10, 2020, 8:19pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/16 "2020-03-10T20:19:32Z")

</div>

> [@Tamas\_Papp](#):
>
> I would be happy to contribute if you get something started.

That would be great, thanks! Meanwhile, I’d like to hear if there’s real interest in the features I tried to build out and if the UX works well for Julia hackers. It works pretty well for me, personally, but I currently only use Julia for side projects. It’d be good to have feedback from more intense users.

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [March 10, 2020, 8:47pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/17 "2020-03-10T20:47:22Z")

</div>

Fwiw, I just pushed the update to `inferior-julia-mode` that I’ve been tinkering with (based on `comint-mode`) [to github](https://github.com/non-Jedi/julia-emacs/commit/be0357cbcffbaec4358467695b39211ff81bbf7c). No completion support yet, but it does support the “?”, “]”, and “;” magics. It’s not quite implementing the REPL in elisp but it avoids some of the pitfalls you’re mentioning.

---

<div class="post-metadata">

**Author:** ![orialb](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@orialb](https://discourse.julialang.org/u/orialb)\
**Post date:** [March 10, 2020, 8:51pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/18 "2020-03-10T20:51:52Z")

</div>

@gcv Is completion supposed to work for functions from stdlib and/or functions from packages which are in the current active envieronment? Currently I get completion only for functions from Base.

---

<div class="post-metadata">

**Author:** ![gcv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcv/32/11086_2.png) [@gcv](https://discourse.julialang.org/u/gcv)\
**Post date:** [March 10, 2020, 9:48pm UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/19 "2020-03-10T21:48:18Z")

</div>

> [@orialb](#):
>
> Is completion supposed to work for functions from stdlib and/or functions from packages which are in the current active envieronment? Currently I get completion only for functions from Base.

Yes, completion should work on everything loaded in the Julia environment with package activation _and_ from loaded source files (i.e., code you’re working on). But judging from our discussion on the [GitHub ticket](https://github.com/gcv/julia-snail/issues/3), we still have some activation bugs to work through.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 11, 2020, 6:47am UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/20 "2020-03-11T06:47:58Z")

</div>

> [@gcv](#):
>
> if there’s real interest in the features I tried to build out and if the UX works well for Julia hackers

Personally I think I will find this environment very useful, but can probably provide more detailed comments once the activation glitches are worked out and I can test it in daily practice.

---

<div class="post-metadata">

**Author:** ![orialb](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@orialb](https://discourse.julialang.org/u/orialb)\
**Post date:** [March 12, 2020, 9:13am UTC](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786/21 "2020-03-12T09:13:15Z")

</div>

> [@gcv](#):
>
> Yes, completion should work on everything loaded in the Julia environment with package activation _and_ from loaded source files (i.e., code you’re working on). But judging from our discussion on the [GitHub ticket](https://github.com/gcv/julia-snail/issues/3), we still have some activation bugs to work through.

So now I have completion working, this is very nice!

I still have a question on the current limitations of code completion. From what I can tell I get completions either from:

1. Base + Packages that I am explicitly `using` in the REPL
2. loaded files.
3. Packages used in a file which I loaded using `julia-snail-send-buffer-file` (but these completions only seem to work in the file that was loaded where the `using` statement is and not in other files).

My typical workflow until now is is to put all code for some project inside a package `MyPacakge`, then `using Revise; using MyPackage` in the REPL.  
Right now if I am working on some file which is part of the package it seems that I won’t get code completions for functions from other packages which are used by `MyPackage`, unless I load these packages myself in the REPL.  
Also it seems to me that I won’t get completions for functions which are defined in some other file in `MyPackage` but not exported, even if I load `MyPackage` using `julia-snail-send-buffer-file`. Is this correct?

[Next page](https://discourse.julialang.org/t/ann-julia-snail-an-emacs-development-environment-first-beta-release/35786.md?page=2)
