Is there any completion plugin for Emacs?

Hi there,

The Julia REPL is really awesome, quiet comparable to what Common Lisp has.

However the code completion tool is rather weak compared with SLIME.

I wonder if there is any existing (or ongoing) code completion for Emacs users?
(Company only completes built-in functions that is a little bit weak.)

Any clues? Thanks!

Thanks for pointing me to Company. I use dabbrev-expand (part of GNU Emacs) with the following key-binding:

(local-set-key (kbd "S-SPC") 'dabbrev-expand)

Emacs expands every word found in the current and also in other buffers according to your customization. I find it very useful.

you can use lsp-julia with company. lsp-julia uses LanguageServer.jl which is not yet available for julia 0.7/1.0.

1 Like

Well, company does work with dabbrev source…However it is really far from satisfying.

Considering the quality of Julia’s REPL, it is really a pity not to have a matching completion framework.

By the way, does Julia have completion back-end anyway?
I think it would be really nice to have a completion back-end that can be used by various completion front-end, so that we have a uniformed completion framework for atom, Emacs, Vim etc etc etc.

As far as I’m aware, that is what LanguageServer.jl is all about.

1 Like

I would already be satisfied to have something that works only for emacs. In particular I would really like to bind the completion with tab. Unfortunately, to the best of my knowledge and after some negative empirical test, this does not seem to be doable.

Also, periodically I google emacs completion (\pm julia) and typically I don’t fill any wiser. The lsp-julia using LanguageServer.jl seems interesting. Looking forward the 0.7/1.0 compatibility.

However, my ideal solution would be to embed a (possibly minimal) version of autocompletion into julia-emacs.

I have thought about this when writing julia-repl, and we discussed this recently in an issue. If someone wants to take up the Julia side (having a background process running which one can query about the names in, say, Main of the actual inferior process), then I am happy to help with the Emacs part.

Tab completion in Emacs is doable, but a little bit tricky.

You may have a look at function completion-at-point-functions that might give you some clues.

I personally wrapped my own completion function as below.

  (defun complete-or-indent ()
	"Complete using company-mode or indent current line by checking "
	 ;; When in region, indent the region.
	  (indent-region (region-beginning) (region-end)))
	 ;; When yasnippet is active, move to next field.
	 ;; When it is possible to complete, do it.
	 ((and (string-match-p company-begin-regex (char-to-string (char-before)))
           (call-when-defined 'company-manual-begin))
	  (call-when-defined 'company-complete-common))
	 (t (indent-for-tab-command))))

I bind it to <tab> key in company-mode. Since I am using company and yasnippet, you may modify the code accordingly…

May it be helpful. :smiley:

You may have a look at completion facility of Common Lisp or Clojure, which I think is really powerful.

I always imagine that there would be a similar tool for Julia.

I would like to help, but do not know exactly where to start… :wink:

The question is not about whether this is possible, or how to do it. Replicating SLIME or equivalent is a major undertaking, and as I say in the issue, this is not something I have time for at the moment.

Thank you @sheepduke. I tried your solution but I guess I have a deeper problem with company-mode. Indeed it seems that company mode does not understand. So my first question is how make company-mode understand julia.

For instance if I open a test.jl file and I try to complete


with M-x company-complete it tells me No completion found. If I tab (after the insertion of your lisp function in my .emacs file there is no reaction from emacs side.

Perhaps could you tell me how did you set up company-mode? BTW my Company version is 0.9.6 (from a `M-x company-version).
Thanks in advance!


Actually we have talked about two questions:

  1. How to (in general) setup company-mode and make it work with indention;
  2. How to make company-mode work with Julia.

I actually answered the first question.

For the second question…I do not have completion for printl either.

The problem is, currently company-mode just does not know Julia. That is why I started this thread…

Thanks again @sheepduke for the clarification on the lack of support on company mode.

You are welcome. :smiley:

I will update this thread and let you know when something new happens in the future.

Have you guys tried Hippie expand? It works very well for me.

1 Like

I have been experimenting with Swank.jl (, a Julia back end for SLIME (the Superior Lisp Interaction Mode for Emacs). It has enough features to be usable(ish), but I’d welcome feedback from other Julia / Lisp / Emacs hackers please.


This is very impressive! Thanks for doing this. Being able to use Swank with Julia would be the best solution IMO, and I would be happy to abandon julia-repl in favor of this.

A couple of minor comments:

  1. Please consider wrapping up the Emacs side of the code in a package and making it available on MELPA. It would be easier to get updates that way.

  2. I suspect some extra code is needed to make the keybindings you list work, is that correct? Is there a minor mode I am missing?

  3. The inability to parse function definition boundaries on the Emacs side has been a long standing issue, see A solution would benefit all related packages, and unless SLIME somehow helps with this perhaps the best home for it would be julia-emacs.

I will be following this project with interest and hope to contribute. Again: awesome work!


Really interesting, I will have to try it out! Do I understand this right that this is meant as a minor mode to julia-mode and replaces julia-repl but can be used jointly with other minor modes such as lsp-mode?

Thank you for creating Swank.jl! I have found that your package gives the most consistent user experience when using Julia in Emacs on Windows, compared to julia-repl and jupyter with IJulia. This may be worth highlighting in the readme of the project.

Looking forward to further developments!

1 Like