charliesome/better_errors — pull request #188 by rmm5t (2013-08-02 23:05:56+00:00)
Title: Provide an automatic, smart default for the BetterErrors.editor

I know this has been addressed before in #128 (/cc @linjunpop), but I'd like to try to make a case for reconsidering the enhancement for better_errors to automatically decide on better editor defaults based on the `EDITOR` environment variable.

Personally, I use better_errors on many projects, and it feels fairly redundant and unnecessary to include `EDITOR` sniffing defaults in each of these projects. Also, the existing pull-request in #128 made some incorrect assumptions about the format for most `EDITOR` env vars (e.g. `EDITOR` usually equals things like "mvim -f" or "subl -w" or "/usr/bin/mate -w" or "emacsclient" -- none of which match the BetterErrors symbol lookups).

I recognize that a precedent has been set here, but I feel strongly about this. Nonetheless, I broke this pull-request up into 3 separate commits in hopes that at least one or two can be cherry-picked in, but with the ultimate desire that all are pulled in.

* b9b5046 - This just adds specs to give better coverage on the existing implementation.
* 10ea99d - This introduces a new BetterErrors.default_editor method that can be used to simplify auto sniffing in case the next commit isn't accepted (e.g. a config initializer in our applications with `BetterErrors.editor = BetterErrors.default_editor` is better than what we currently have to copy between projects). The specs here cover many common `EDITOR` env var use cases.
* 1f310e4 - Bringing it all together to let better_errors use the `default_editor` behavior _automatically_!

(The specs run clean