asdf-elixir icon indicating copy to clipboard operation
asdf-elixir copied to clipboard

Formatting from within emacs fails to find erlang executable

Open emanuelmd opened this issue 3 years ago • 1 comments

Trying to format an elixir file from within emacs, using elixir-mode, fails with the following error:

/home/emanuel/.asdf/installs/elixir/1.13.4/bin/elixir: line 243: exec: erl: not found

I've looked around and found this issue to be relevant to the discussion although it didn't solve my problem. Curiously, when running emacs from a terminal, formatting works. Here's the output of my asdf info

OS:
Linux 5.18.12-arch1-1

SHELL:
fish, version 3.4.1

ASDF VERSION:
v0.10.2-7e7a1fa

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/home/emanuel/.asdf

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master d08f506
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 0463971

Not entirely sure what triggered this issue but at some point I upgraded asdf, asdf plugins and emacs plugins. The error message points to asdf.

Please advise!

emanuelmd avatar Aug 01 '22 03:08 emanuelmd

Hi @emanuelmd, I am not sure what the problem is either, and I am not familiar with how elixir-mode works.

Curiously, when running emacs from a terminal, formatting works.

To me that suggests some sort of path or loading issue. Did you try asdf reshim? I doubt it will work but it is worth a try. Can you run the following commands in emacs started from the shell and started from... wherever you started the other emacs instance?

  • type -a elixir
  • type -a erl
  • echo $PATH

Running those commands from both instances of emacs should reveal in difference somewhere.

Stratus3D avatar Aug 10 '22 21:08 Stratus3D

Hey @Stratus3D, apologies for the delayed reply and thank you for taking interest in my issue.

I did try asdf reshim and sadly it didn't help.

Both type -a commands point to ~/.asdf/shims/elixir and ~/.asdf/shims/erlang respectively The exec-path from emacs has ~/.asdf/shims/ included.

emanuelmd avatar Aug 22 '22 09:08 emanuelmd

Digging further I found that exec-path-from-shell may help. I installed it and magically my executables are found by emacs, I reckon this is not an issue with asdf or asdf-elixir plugin. Thanks nonetheless.

emanuelmd avatar Aug 22 '22 10:08 emanuelmd