Hi all,
I’m new to Elixir. I’m trying to use IEx in Emacs. Right now the code completion isn’t supported, and I don’t know how to get the completion from Elixir/IEx programmatically, I tried IEx.Autocomplete.expand "String."
but it doesn’t work (I expect it to return a list of completions so I can use it from Emacs.):
iex(11)> IEx.Autocomplete.expand "String."
** (FunctionClauseError) no function clause matching in IEx.Autocomplete.expand/2
The following arguments were given to IEx.Autocomplete.expand/2:
# 1
"String."
# 2
IEx.Server
Attempted function clauses (showing 2 out of 2):
def expand([], server)
def expand([h | t] = expr, server)
(iex) lib/iex/autocomplete.ex:6: IEx.Autocomplete.expand/2
Emacs setup:
(define-derived-mode inferior-elixir-mode comint-mode "Inferior Elixir"
"Major mode for Elixir inferior process."
(setq comint-prompt-regexp (rx bol (or "iex" "...") "(" (1+ num) ") ")))
(defun run-elixir ()
(interactive)
(with-current-buffer (make-comint-in-buffer "Elixir" "*Elixir*" "iex" nil)
(inferior-elixir-mode)
(display-buffer (current-buffer))))