From 790b06e0c363ce1598deb3bde217c4685701b61d Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 16 Jun 2017 14:03:21 +0200 Subject: bugfix: support EDITOR values with spaces (#4523) - previous code called `which` on $EDITOR, but that doesn't work for EDITORs like `emacs -nw` or `emacsclient -t -nw`. - This patch just trusts EDITOR if it is set (same as previous behavior), and only uses the defaults if it's not. --- lib/spack/spack/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') 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] -- cgit v1.2.3-70-g09d2