senny / rvm.el

use rvm to manage ruby versions within emacs
214 stars 42 forks source link

Load Elisp files from Ruby's source #20

Closed habib closed 12 years ago

habib commented 12 years ago

When switching Rubies add the Elisp files that ship with the Ruby source to the load-path. These are located in ~/.rvm/src/ruby/misc

senny commented 12 years ago

hey habib. Thanks for your contribution but there are some issues with the patch. First you should include a customizeable variable so that this behaviour can be disabled and It should be disabled by default. I don't want to mess up peoples emacs settings when they use rvm.el (I also use a customized ruby-mode.el and a modified inf-ruby.el so I can't use the bundled ones). Add a guard variable like rvm-use-elisp-files-bundled-with-ruby which turns the behaviour off completely.

The second thing I noticed is that it wont work with gemsets. You will get messy paths added to your load-path like:

~/.rvm/src/ruby-1.9.2-p290@my-rails-gemset/misc/

The third thing is, that you didn't consider usecases where multiple rubies are used in the same emacs session. Your code would pollute the 'load-path variable with a new path everytime I switch ruby or gemset. Since I don't close Emacs often and switch rubies a lot, this would result in a load-path containing every ruby I got installed. I think you should remove the old source when you add the load-path to another one. The problem beeing that the elisp files won't be reloaded when you switch rubies.

I'm not sure if it makes too much sense to add this to rvm.el. I guess if you want to use a specific version of ruby-mode.el or inf-ruby.el you can always directly add it to the load-path in your init.el

I'll leave the pull-request open. If there are other people who would like to use this feature I'll merge it in.

habib commented 12 years ago

Hey Senny, thank you for quick replying with valid points. I had this working for my simple use cases but I neglected to cater to other scenarios. I'll fix the issues you mentioned and re-submit a request.