ESS and autocompletion for Julia

389 views
Skip to first unread message

Ivan Bocharov

unread,
Oct 27, 2015, 6:57:56 AM10/27/15
to julia-users
Hello All,

I am a newbie Emacs user and I really want to write my Julia code in Emacs. I've installed Emacs using brew and ESS from MELPA.

I can get TAB-autocompletion in Julia shell, but the autocompletion doesn't work in my own scripts. Is it supposed to be this way or am I missing something?

My current setup is: Emacs from brew (GNU Emacs 24.5.1), Julia v.0.4.0 and ESS v. 15.09-1 (output from M-x ess-version).

My init.el file looks this way:

(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list
   'package-archives
   '("melpa" . "http://melpa.org/packages/")
   t)
  (package-initialize))

(require 'ess-site)
(setq inferior-julia-program-name "julia")
(setq ess-use-auto-complete t)
(setq ess-tab-complete-in-script t)

(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete/dict")

(set-default 'ac-sources
    '(ac-source-abbrev
      ac-source-dictionary
      ac-source-yasnippet
      ac-source-words-in-buffer
      ac-source-words-in-same-mode-buffers
      ac-source-semantic))

(ac-config-default)

As a side note I wanted to thank all the contributors and the community for their work!

Best, Ivan.

Ista Zahn

unread,
Oct 27, 2015, 10:38:13 AM10/27/15
to julia...@googlegroups.com
It works for me with the company backend. Haven't tried the
autocomplete backend recently. I think ESS prefers the company
backend, so just installing and loading the company package may be
enough.

Note that for completions to work you need to have an inferior julia
process running, and the Julia Compat package must be installed.

Best,
Ista

Ivan Bocharov

unread,
Oct 27, 2015, 5:12:32 PM10/27/15
to julia-users
Thank you very much for your reply!

I have Compat package installed, julia process running and tried both autocomplete and company. TAB-completion still doesn't work, though, invoking C-M-i produces some results. The thing is that i can complete only the contents from the Base (some types and functions) and can't complete my own functions and objects. Also, for example, 'func' completes to 'functionloc'. Is this the desired behaviour?

Best,
Ivan

вторник, 27 октября 2015 г., 15:38:13 UTC+1 пользователь Ista Zahn написал:

Ista Zahn

unread,
Oct 27, 2015, 9:21:47 PM10/27/15
to julia...@googlegroups.com
Does tab completion work in other languages supported by ESS? If it
doesn't then there would appear to be something missing from your ESS
settings (I don't bind completion to TAB myself, there is too much
already happening on the TAB key). If it works for (e.g.) R but not
Julia I would report a bug to ESS.

For me completion of my own functions and objects works fine. You do
have to evaluate them in the REPL though. ESS completion works be
asking the running REPL for completions, so if the object hasn't been
defined there it won't show up in the completion list.

As for 'fun' completing to 'functionloc', yeah, that's what I see too.
I think it doesn't work for the same reason '@doc function' doesn't
work. I'm sure ESS bug reports and pull requests would be appreciated.

Best,
Ista

Ivan Bocharov

unread,
Oct 29, 2015, 5:48:59 AM10/29/15
to julia-users
Thanks for pointing out that the Julia process should be running in the background.

It turned out that the problem for Julia autocompletion was caused by "non-global" global autocomplete mode. I've managed to find a function that defined behaviour that I was looking for here:


Once again, thank you for your help!

Best, Ivan



среда, 28 октября 2015 г., 2:21:47 UTC+1 пользователь Ista Zahn написал:
Reply all
Reply to author
Forward
0 new messages