elisp: Fix usage of legacy-interactive

This commit is contained in:
Daniel Gröber 2015-05-06 16:32:53 +02:00
parent aa75d2213e
commit e202fabc39
4 changed files with 21 additions and 15 deletions

View File

@ -38,6 +38,7 @@ gmComponentNameDoc (ChTestName n) = text $ "test:" ++ n
gmComponentNameDoc (ChBenchName n) = text $ "bench:" ++ n gmComponentNameDoc (ChBenchName n) = text $ "bench:" ++ n
gmLogLevelDoc :: GmLogLevel -> Doc gmLogLevelDoc :: GmLogLevel -> Doc
gmLogLevelDoc GmSilent = error "GmSilent MUST not be used for log messages"
gmLogLevelDoc GmPanic = text "PANIC" gmLogLevelDoc GmPanic = text "PANIC"
gmLogLevelDoc GmException = text "EXCEPTION" gmLogLevelDoc GmException = text "EXCEPTION"
gmLogLevelDoc GmError = text "ERROR" gmLogLevelDoc GmError = text "ERROR"

View File

@ -163,7 +163,8 @@ type ModuleString = String
-- | A Module -- | A Module
type Module = [String] type Module = [String]
data GmLogLevel = GmPanic data GmLogLevel = GmSilent
| GmPanic
| GmException | GmException
| GmError | GmError
| GmWarning | GmWarning

View File

@ -20,7 +20,7 @@
(defvar-local ghc-process-callback nil) (defvar-local ghc-process-callback nil)
(defvar-local ghc-process-hook nil) (defvar-local ghc-process-hook nil)
(defvar ghc-command "ghc-modi") (defvar ghc-command "ghc-mod")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -63,7 +63,7 @@
(t cpro))) (t cpro)))
(defun ghc-start-process (name buf) (defun ghc-start-process (name buf)
(let* ((opts (append '("--legacy-interactive" "-b" "\n" "-l") (ghc-make-ghc-options))) (let* ((opts (append '("legacy-interactive" "-b" "\n" "-l" "-s") (ghc-make-ghc-options)))
(pro (apply 'start-file-process name buf ghc-command opts))) (pro (apply 'start-file-process name buf ghc-command opts)))
(set-process-filter pro 'ghc-process-filter) (set-process-filter pro 'ghc-process-filter)
(set-process-sentinel pro 'ghc-process-sentinel) (set-process-sentinel pro 'ghc-process-sentinel)

View File

@ -11,7 +11,6 @@ import Data.Version (showVersion)
import Data.Default import Data.Default
import Data.List import Data.List
import Data.List.Split import Data.List.Split
import Data.Maybe
import Data.Char (isSpace) import Data.Char (isSpace)
import Exception import Exception
import Language.Haskell.GhcMod import Language.Haskell.GhcMod
@ -20,12 +19,10 @@ import Paths_ghc_mod
import System.Console.GetOpt (OptDescr(..), ArgDescr(..), ArgOrder(..)) import System.Console.GetOpt (OptDescr(..), ArgDescr(..), ArgOrder(..))
import qualified System.Console.GetOpt as O import qualified System.Console.GetOpt as O
import System.Directory (setCurrentDirectory) import System.Directory (setCurrentDirectory)
import System.Environment (getArgs,getProgName) import System.Environment (getArgs)
import System.Exit (exitFailure) import System.Exit (exitFailure)
import System.IO (hPutStrLn, stdout, stderr, hSetEncoding, utf8, hFlush) import System.IO (hPutStrLn, stdout, stderr, hSetEncoding, utf8, hFlush)
import System.IO.Unsafe (unsafePerformIO) import System.Exit (exitSuccess)
import System.FilePath (takeFileName)
import System.Exit (ExitCode, exitSuccess)
import Text.PrettyPrint import Text.PrettyPrint
import Misc import Misc
@ -232,16 +229,23 @@ option s l udsc dsc = Option s l dsc udsc
reqArg :: String -> (String -> a) -> ArgDescr a reqArg :: String -> (String -> a) -> ArgDescr a
reqArg udsc dsc = ReqArg dsc udsc reqArg udsc dsc = ReqArg dsc udsc
optArg :: String -> (Maybe String -> a) -> ArgDescr a
optArg udsc dsc = OptArg dsc udsc
intToLogLevel :: Int -> GmLogLevel
intToLogLevel = toEnum
globalArgSpec :: [OptDescr (Options -> Options)] globalArgSpec :: [OptDescr (Options -> Options)]
globalArgSpec = globalArgSpec =
[ option "v" ["verbose"] "Can be given multiple times to be increasingly\ [ option "v" ["verbose"] "Increase or set log level. (0-6)" $
\ be more verbose." $ optArg "LEVEL" $ \ml o -> o {
NoArg $ \o -> o { logLevel = increaseLogLevel (logLevel o) } logLevel = case ml of
Nothing -> increaseLogLevel (logLevel o)
, option "s" [] "Can be given multiple times to be increasingly be less\ Just l -> toEnum $ min 6 $ read l
\ verbose." $ }
NoArg $ \o -> o { logLevel = decreaseLogLevel (logLevel o) }
, option "s" [] "Be silent, set log level to 0" $
NoArg $ \o -> o { logLevel = toEnum 0 }
, option "l" ["tolisp"] "Format output as an S-Expression" $ , option "l" ["tolisp"] "Format output as an S-Expression" $
NoArg $ \o -> o { outputStyle = LispStyle } NoArg $ \o -> o { outputStyle = LispStyle }