senny/rvm.el — pull request #46 by jrep (2014-04-26 01:00:19+00:00)
Title: Near beats far: Conform to RVM's behavior when rc files are found several depths up-tree

(See #45)

RVM does

* For each containing directory above the start point
* if there's a `.rvmrc`, use it; else use `.ruby-version`; else use `Gemfile`
* else, recurse up-tree

In this way, the precedence among files at a given depth is ".rvmrc > .ruby-version > Gemfile", but nearer files of any name win over remoter files of any name.

`rvm.el` currently uses different logic:

* Search all the way up-tree for `.rvmrc`; if found, use it
* Else search all over again, for `.ruby-version`; if found, use it
* Else search one more time for `Gemfile`; use or give up

Where there are several rc files up-tree, of different depths and different types (file names), `rvm` and `rvm.el` may choose different settings.

This fixes that.