tonini / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
906 stars 102 forks source link

Using Alchemist *and* rbenv at the same time #291

Open Bounga opened 7 years ago

Bounga commented 7 years ago

Hello. I'm a former Rubyist so I handle my Ruby versions using rbenv. I integrated it into my Emacs using https://github.com/senny/rbenv.el. This plugin is always on in my setup ((global-rbenv-mode)).

I'm using:

As I'm doing more and more Elixir I really like the powerful integration that Alchemist does provide. One thing I often use is alchemist-iex-run but when rbenv emacs plugin is on I get this error looping:

/Users/nico/.rbenv/bin/iex: line 36: cd: ../Cellar/elixir/1.4.1/bin: No such file or directory

So I never get the interaction shell. Most of the features provided by Alchemist are broken for me.

Here's what I get when I search for IEx location:

$ which iex
/usr/local/bin/iex

Does anyone else have this issue? Can you think of a fix or workaround ? I know I can disable rbenv plugin when I want to use Alchemist but it's kind of annoying.

It would be so great if someone could find a fix to my issue.

Thank you.

tonini commented 7 years ago

Hi @Bounga

I would say this is not an rbenv related issue at all. I recommend using something like https://github.com/purcell/exec-path-from-shell from purcell to resolve the environment variables for the correct paths.

Bounga commented 7 years ago

I already use exec-path-from-shell otherwise rbenv can't find its bin 😉

Bounga commented 7 years ago

So no clue about this. I do thin there's something related with rbenv emacs plugin works like a charm since disabling it makes alchemist works. Something happens with the path handling when both ar enabled and alchemist tries to resolve path to iex.

I do have this config and maybe it could help:

(use-package rbenv
  :ensure t
  :config
  (global-rbenv-mode))

(use-package alchemist
  :ensure t)

(use-package exec-path-from-shell
  :ensure t
  :init
  (defvar mac-option-key-is-meta nil)
  (defvar mac-command-key-is-meta t)

  (setq mac-command-modifier 'meta
        mac-option-modifier 'super
        mac-right-option-modifier nil)

  :config
  (setq exec-path-from-shell-check-startup-files nil)
  (exec-path-from-shell-initialize))
Trevoke commented 7 years ago

So.. Sidestepping the issue would mean launching rbenv mode only for Ruby files, which might be good enough for you.

Otherwise we should go dive into the rbenv package and see what it's doing.

Bounga commented 7 years ago

Thank you @Trevoke. I'll go with the "use rbenv only when in ruby-mode" then. It should do the trick for me.