Emacs - Elixir Setup Configuration Wiki

I has just update Emacs and all relevant packages for Elixir. So that I share some short steps to whom it may help.

  1. Install packages by config init.el
 (require 'package)
 (dolist (source '(("org" . "https://orgmode.org/elpa/")
                       ("melpa-stable" . "https://stable.melpa.org/packages/")
                       ("melpa" . "https://melpa.org/packages/")
                       ))
       (add-to-list 'package-archives source t))
     ;; Prefer stable packages.
     (setq package-archive-priorities '(("melpa-stable" . 1)
					("melpa" . 2)))
(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))

;;Package list
(defvar anyname/packages
  '(helm helm-ag rg paredit use-package erlang elixir-mode flycheck lsp-mode lsp-ui company)

;;Run the defined packages if not install will be install
(dolist (p anyname/packages)
  (unless (package-installed-p p)
    (package-install p)))


  1. Install elixir-ls and config as this guide
    GitHub - elixir-lsp/elixir-ls: A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol" · GitHub
Download the latest release: https://github.com/elixir-lsp/elixir-ls/releases/latest and unzip it into a directory (this is the directory referred to as the "path-to-elixir-ls/release" below)

If using lsp-mode add this configuration:

  (use-package lsp-mode
    :commands lsp
    :ensure t
    :diminish lsp-mode
    :hook
    (elixir-mode . lsp)
    :init
    (add-to-list 'exec-path "path-to-elixir-ls/release"))
1 Like