asdf-vm / asdf-elixir

Elixir plugin for asdf version manager
https://github.com/asdf-vm/asdf
MIT License
473 stars 70 forks source link

Formatting from within emacs fails to find erlang executable #116

Closed emanuelmd closed 2 years ago

emanuelmd commented 2 years ago

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!

Stratus3D commented 2 years ago

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?

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

emanuelmd commented 2 years ago

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 commented 2 years ago

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.