Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rvm.el always defaults to global gemset #27

Closed
localredhead opened this issue Oct 8, 2012 · 11 comments
Closed

rvm.el always defaults to global gemset #27

localredhead opened this issue Oct 8, 2012 · 11 comments

Comments

@localredhead
Copy link

I installed the latest RVM using el-get as of this morning because of this issue, however now when I try to use rvm-use I get the following error:

Unrecognized command line argument(s): '=* ruby-1.9.3-p194 list' ( see: 'rvm usage' )

It looks like the command is reading in what my system shows about the ruby if I were to issue the rvm command from the terminal.

That issue itself seems minor over the fact that every time I start emacs, I have to tell it to rvm-use and then select my gemset which is already set by RVM but rvm.el does not see it and defaults to @global.

I only have 2 gemsets on my machine and global should never be the default. How do I make rvm.el use what I set as my default within RVM?

I'm on Ubuntu 12.04 LTS using the default terminal and I have added rvm path info to my .bashrc

@senny
Copy link
Owner

senny commented Oct 9, 2012

rvm currently uses the global gemset as hard coded default. The ruby version is read from your shell configuration.
You could set the variable rvm--gemset-default to a string other than "global" but this can break when you switch ruby implementation.

You can also put (rvm-use "ruby-version" "gemset-name") in your emacs configuration and it will active it on load.

regarding the first error I'm not sure where the problem lies. Can you evaluate (rvm/list) and (rvm/list "default") and send me the result?

@localredhead
Copy link
Author

I think if I set it in my .init file I will be able to work around this. I should note that the rvm.el that is obtained via ELPA does not have this issue.

(rvm/list) outputs ("ruby-1.8.7-p370" "=* ruby-1.9.3-p194")
(rvm/list "default") outputs ("ruby-1.9.3-p194")

@senny
Copy link
Owner

senny commented Oct 9, 2012

@localredhead I see. The one in ELPA is a bit outdated. The output clearly indicates that there is a bug. I'll look at it as soon as I got a few minutes.

@senny
Copy link
Owner

senny commented Feb 6, 2013

sorry for the horribly delayed response. Do you still experience that problem? What version of rvm and rvm.el are you using? How does the output of a simple rvm list look on your machine?

@localredhead
Copy link
Author

I do still have to explicitly tell rvm.el which gemset to use, even though I have a default gemset defined. I worked around it by using .rvmrc with the following:

(add-hook 'ruby-mode-hook
          (lambda () (rvm-activate-corresponding-ruby)))  ;make sure you have a .rvmrc ! run rvm --rvmrc --create ruby@gemset 

I have tried both ELPA rvm-20121003.921 and rvm.el from your repo. Both seemed to display the same issue.

Output of rvm list:

~/.emacs.d/elpa $ rvm list

rvm rubies

 * ruby-1.9.3-p327 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Output of rvm list gemsets:

 ~/.emacs.d/elpa $ rvm list gemsets

rvm gemsets

   ruby-1.9.3-p327 [ x86_64 ]
   ruby-1.9.3-p327@global [ x86_64 ]
   ruby-1.9.3-p327@jiff [ x86_64 ]
=> ruby-1.9.3-p327@salus [ x86_64 ]
   ruby-1.9.3-p327@tracs [ x86_64 ]

Output of (rvm-use-default) :

Ruby: ruby-1.9.3-p327 Gemset: global

@localredhead
Copy link
Author

I'm on OSX now, whereas before I was on Ubuntu. I doubt that matters much.

Allow me to thank you for rvm.el anyways. Without it I'd be lost and I am happy with my work around I have. I've found that using the .rvmrc is a good practice.

@senny
Copy link
Owner

senny commented Feb 8, 2013

Did you change your installed rubies? In the first description you mentioned:

(rvm/list) outputs ("ruby-1.8.7-p370" "=* ruby-1.9.3-p194")

But when you execute rvm list all you get is:


rvm rubies

 * ruby-1.9.3-p327 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

I'm still trying to figure out where the parsing goes wrong because I'm using the latest version of rvm.el, rvm and everything runs on OS-X.

@localredhead
Copy link
Author

Yeah my installed ruby is different now. I am on a different machine than the one I was on when I opened the issue and I stay up to date on my ruby versions.

I may be confused as to the intended functionality though - I assume (rvm-use-default) would use what I have set as the default ruby AND gemset combo. Instead (rvm-use-default) uses what the default ruby is, but uses the GLOBAL gemset.

@senny
Copy link
Owner

senny commented Feb 10, 2013

but this means you no longer receive the original error described in the issue:

Unrecognized command line argument(s): '=* ruby-1.9.3-p194 list' ( see: 'rvm usage' )

regarding the gemset. I don't know of a way to specify a default gemset with rvm (there might be one though...). The current implementation of rvm.el has a variable called rvm--gemset-default. You can set the appropriate gemset that you want to use when you call (rvm-use-default).

Does this solve your problem?

(setq rvm--gemset-default "my-default-gemset")

@localredhead
Copy link
Author

It doesn't, but thats fine. When I create a gemset with rvm and make it the default, I typically do rvm use 1.9.3@gemsetname --create --default
That makes that particular gemset the default for my system. I guess I expected that when I do (rvm-use-default)
that it would use that gemset as well. It sounds like that is not the intended functionality.

My goal is to not have to explicitly set my gemset using elisp. I may switch my default gemset when I switch to a new project and because of that I'd want rvm-use-default to pickup that change. I think using the .rvmrc file is the best solution for what I'm going after.

You can feel free to close this if you like. I have a work around for what I want by setting my init.el to activate my corresponding ruby using .rvmrc.

@senny
Copy link
Owner

senny commented Feb 13, 2013

thanks for your time! currently rvm.el only picks up the default ruby version. Closing this for now. Let me know if you are having other problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants