config -e: Parse arguments in $EDITOR (fix #1200)

This commit is contained in:
Adrian Sampson 2015-01-04 17:46:08 -08:00
parent 1f3fc60bad
commit e13e7ed727
2 changed files with 9 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import time
import codecs import codecs
import platform import platform
import re import re
import shlex
import beets import beets
from beets import ui from beets import ui
@ -1503,7 +1504,12 @@ def config_edit():
if 'EDITOR' in os.environ: if 'EDITOR' in os.environ:
editor = os.environ['EDITOR'] editor = os.environ['EDITOR']
args = [editor, editor, path] try:
editor = shlex.split(editor)
except ValueError: # Malformed shell tokens.
editor = [editor]
args = editor + [path]
args.insert(1, args[0])
elif platform.system() == 'Darwin': elif platform.system() == 'Darwin':
args = ['open', 'open', '-n', path] args = ['open', 'open', '-n', path]
elif platform.system() == 'Windows': elif platform.system() == 'Windows':

View file

@ -68,6 +68,8 @@ Fixed:
twice in the artist string. Thanks to Marc Addeo. :bug:`1179` :bug:`1181` twice in the artist string. Thanks to Marc Addeo. :bug:`1179` :bug:`1181`
* :doc:`/plugins/lastgenre`: Match songs more robustly when they contain * :doc:`/plugins/lastgenre`: Match songs more robustly when they contain
dashes. Thanks to :user:`djl`. :bug:`1156` dashes. Thanks to :user:`djl`. :bug:`1156`
* The :ref:`config-cmd` command can now use ``$EDITOR`` variables with
arguments.
.. _API changes: http://developer.echonest.com/forums/thread/3650 .. _API changes: http://developer.echonest.com/forums/thread/3650
.. _Plex: https://plex.tv/ .. _Plex: https://plex.tv/