on master help sign in
Merge pull request #2971 from melted/editor_var
64ee875Niklas Larsson
CHANGELOG.md+5
@@ -39,6 +39,11 @@
39* The test suite now uses [tasty-golden](https://hackage.haskell.org/package/tasty-golden). New tests must be registered in `test/TestData.hs`, as explained in the relevant `README.md`.
39* The test suite now uses [tasty-golden](https://hackage.haskell.org/package/tasty-golden). New tests must be registered in `test/TestData.hs`, as explained in the relevant `README.md`.
40* Added OSX and Windows continous integration with Travis and Appveyor.
40* Added OSX and Windows continous integration with Travis and Appveyor.
41
41
42+## UI Changes
43+
44+* The :e command can now handle an $EDITOR with arguments in it, like "emacs -nw"
45+
46+
42# New in 0.12:
47# New in 0.12:
43
48
44## Language updates
49## Language updates
src/Idris/REPL.hs+9−6
@@ -786,10 +786,10 @@ edit f orig
786 env <- runIO getEnvironment
786 env <- runIO getEnvironment
787 let editor = getEditor env
787 let editor = getEditor env
788 let line = case errSpan i of
788 let line = case errSpan i of
789− Just l -> ['+' : show (fst (fc_start l))]
789+ Just l -> '+' : show (fst (fc_start l))
790− Nothing -> []
790+ Nothing -> ""
791− let args = line ++ [fixName f]
791+ let cmdLine = intercalate " " [editor, line, fixName f]
792− runIO $ rawSystem editor args
792+ runIO $ system cmdLine
793 clearErr
793 clearErr
794 -- The $!! here prevents a space leak on reloading.
794 -- The $!! here prevents a space leak on reloading.
795 -- This isn't a solution - but it's a temporary stopgap.
795 -- This isn't a solution - but it's a temporary stopgap.
@@ -804,8 +804,11 @@ edit f orig
804 where getEditor env | Just ed <- lookup "EDITOR" env = ed
804 where getEditor env | Just ed <- lookup "EDITOR" env = ed
805 | Just ed <- lookup "VISUAL" env = ed
805 | Just ed <- lookup "VISUAL" env = ed
806 | otherwise = "vi"
806 | otherwise = "vi"
807− fixName file | map toLower (takeExtension file) `elem` [".lidr", ".idr"] = file
807+ fixName file | map toLower (takeExtension file) `elem` [".lidr", ".idr"] = quote file
808− | otherwise = addExtension file "idr"
808+ | otherwise = quote $ addExtension file "idr"
809+ where
810+ quoteChar = if isWindows then '"' else '\''
811+ quote s = [quoteChar] ++ s ++ [quoteChar]
809
812
810
813
811
814