spacemacs icon indicating copy to clipboard operation
spacemacs copied to clipboard

ruby layer with rvm sets ruby version and gemset on every file open within a project

Open RomanKapitonov opened this issue 7 years ago • 8 comments

Description

RVM ruby version and gemset is being set on every *.rb file open withing a rails project

Reproduction guide

  • Start Emacs
  • Open a file from rails project with .ruby-version and .ruby-gemset file present within project's root
  • SPC-p-f and open a file file within a project
  • Navigate to another file
  • Open the file

Observed behaviour: Ruby version and ruby gemset is being set on every file open which takes some time.

Expected behaviour: Ruby version and ruby gemset is set once for a project containing either .rvmrc or .ruby-version files.

System Info :computer:

  • OS: darwin
  • Emacs: 25.1.1
  • Spacemacs: 0.200.9
  • Spacemacs branch: master (rev. 8e1af14)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(haskell yaml helm sql osx
         (version-control :variables version-control-diff-side 'left)
         git github html
         (ruby :variables ruby-version-manager 'rvm ruby-test-runner 'rspec)
         emacs-lisp markdown auto-completion
         (spell-checking :variables spell-checking-enable-by-default nil)
         custom-layers)
  • System configuration features: JPEG RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

Backtrace

When opening 3 different files I get the following in the Messages buffer:

Ruby: 2.3.0 Gemset: gemset_name [3 times]

RomanKapitonov avatar Jul 28 '17 09:07 RomanKapitonov

Disclaimer. I am not familiar with rvm as I don't speak ruby.

Is it bad that rvm-activate-corresponding-ruby is called whenever you visit ruby file?


Relevant code from ruby layer.

      (spacemacs/add-to-hooks 'rvm-activate-corresponding-ruby
                              '(ruby-mode-hook enh-ruby-mode-hook))

d12frosted avatar Jul 29 '17 18:07 d12frosted

It is neither good, nor bad. It is just slow. It takes up to one second to open a new buffer with ruby file. Once a buffer exists switching to it takes no time. It would be nice to have rvm activation being done once during project load, but I'm lacking skills to fix that myself.

RomanKapitonov avatar Jul 31 '17 10:07 RomanKapitonov

There is a potential duplicate of the issue https://github.com/syl20bnr/spacemacs/issues/6569

RomanKapitonov avatar Jul 31 '17 11:07 RomanKapitonov

This issue is still there in 2019. I confirm calling rvm-activate-corresponding-ruby every time before opening the ruby file is the issue. It takes 7-8 seconds in my machine.

Have any of you found the solution to the problem?

I believe we should be calling rvm-activate-corresponding-ruby asynchronously. It may be simple to say but it may be complex to implement.

antonyr avatar Apr 13 '19 18:04 antonyr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

github-actions[bot] avatar Apr 12 '20 18:04 github-actions[bot]

I have exactly the same issue in 2020. Moreover, when I restart a spacemacs it does rvm command for each buffer in cache. And spacemacs takes more than a minute to start working.

kirill-snap avatar Oct 23 '20 22:10 kirill-snap

Still actual

alexshagov avatar Sep 28 '21 11:09 alexshagov

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

github-actions[bot] avatar May 01 '24 16:05 github-actions[bot]