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
gmLogLevelDoc :: GmLogLevel -> Doc
gmLogLevelDoc GmSilent = error "GmSilent MUST not be used for log messages"
gmLogLevelDoc GmPanic = text "PANIC"
gmLogLevelDoc GmException = text "EXCEPTION"
gmLogLevelDoc GmError = text "ERROR"

View File

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

View File

@ -20,7 +20,7 @@
(defvar-local ghc-process-callback nil)
(defvar-local ghc-process-hook nil)
(defvar ghc-command "ghc-modi")
(defvar ghc-command "ghc-mod")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -63,7 +63,7 @@
(t cpro)))
(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)))
(set-process-filter pro 'ghc-process-filter)
(set-process-sentinel pro 'ghc-process-sentinel)

View File

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