diff options
-rw-r--r-- | lib/spack/spack/__init__.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index 214bb09878..3f99c5581c 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -212,16 +212,16 @@ import spack.util.executable from spack.util.executable import * __all__ += spack.util.executable.__all__ -# User's editor from the environment -# Default editors to use: -_default_editors = ['vim', 'vi', 'emacs', 'nano'] +# Set up the user's editor +# $EDITOR environment variable has the highest precedence +editor = os.environ.get('EDITOR') -# The EDITOR environment variable has the highest precedence -if os.environ.get('EDITOR'): - _default_editors.insert(0, os.environ.get('EDITOR')) - -editor = which(*_default_editors) +# if editor is not set, use some sensible defaults +if editor is not None: + editor = Executable(editor) +else: + editor = which('vim', 'vi', 'emacs', 'nano') if not editor: default = default_editors[0] |