alchemist.el icon indicating copy to clipboard operation
alchemist.el copied to clipboard

Using Alchemist *and* rbenv at the same time

Open Bounga opened this issue 8 years ago • 5 comments
trafficstars

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:

  • OS X 10.11.6
  • GNU Emacs 25.1.1
  • Alchemist 1.9.0
  • Erlang/OTP 19
  • Elixir 1.4.1

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.

Bounga avatar Feb 21 '17 13:02 Bounga

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.

tonini avatar Feb 22 '17 08:02 tonini

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

Bounga avatar Feb 22 '17 08:02 Bounga

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))

Bounga avatar Feb 27 '17 20:02 Bounga

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.

Trevoke avatar Mar 16 '17 12:03 Trevoke

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

Bounga avatar Mar 16 '17 16:03 Bounga