alchemist.el
alchemist.el copied to clipboard
Alchemist not auto-loading with elixir-mode
Having installed Alchemist via melpa, it doesn't activate alchemist-mode with elixir-mode in emacs-prelude.
Interestingly, manually evaluating
(add-hook 'elixir-mode-hook 'alchemist-mode-hook)
(as seen in alchemist.el) and then switching out and back into elixir-mode also doesn't activate alchemist-mode.
Instead, evaluating
(add-to-list 'elixir-mode-hook (alchemist-mode +1))
and then re-switching into elixir-mode does activate alchemist-mode (I therefore added this to my personal/init.el).
I have no idea why it makes a difference, but maybe someone else might be experiencing this problem.
I am using the latest emacs-prelude, emacs version 25.1.50.1. I'm by no means experienced with emacs, so if I'm missing something just close the issue :) Furthermore, this might be an isolated emacs-prelude problem..?
I think you should write
(add-to-list 'elixir-mode-hook 'alchemist-mode)
Because a function alchemist-mode-hook
is not an autoloaded function.
(add-to-list 'elixir-mode-hook (alchemist-mode +1))
This code works because
- Evaluate
(alchemist-mode +1)
- alchemist-mode command is an autoloaded function so that alchemist.el is loaded at that time
- Evaluate this code and set
alchemist-mode-hook
toelixir-mode-hook
. - alchemist.el is already loaded so 3. code works.
However this is not lazy loading and this equals to (require 'alchemist)