summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-12-08 13:07:17 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-30 14:11:48 -0500
commitf5d62eb2d5a1058f355aaa1fd0a959694d160ec4 (patch)
tree19f568ae8d1ee963bc21b15b9dea502330314264 /ghc
parentbd0b27267985c6c3482578ccf71a3cab9a1d7b12 (diff)
downloadhaskell-f5d62eb2d5a1058f355aaa1fd0a959694d160ec4.tar.gz
ghci: Take editor from VISUAL environment variable
Following the example of `git`, as noted in #19030. Fixes #19030.
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index b2909c2441..77801019ee 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -427,13 +427,14 @@ defFullHelpText =
findEditor :: IO String
findEditor = do
- getEnv "EDITOR"
- `catchIO` \_ -> do
+ getEnv "VISUAL" <|> getEnv "EDITOR" <|> defaultEditor
+ where
+ defaultEditor = do
#if defined(mingw32_HOST_OS)
- win <- System.Win32.getWindowsDirectory
- return (win </> "notepad.exe")
+ win <- System.Win32.getWindowsDirectory
+ return (win </> "notepad.exe")
#else
- return ""
+ return ""
#endif
default_progname, default_stop :: String