ghc-mod 0.6.1 → 0.6.2
raw patch · 5 files changed
+24/−11 lines, 5 files
Files
- Cabal.hs +9/−4
- GHCMod.hs +1/−1
- Types.hs +6/−5
- elisp/ghc.el +7/−0
- ghc-mod.cabal +1/−1
Cabal.hs view
@@ -2,6 +2,7 @@ module Cabal (initializeGHC) where import Control.Applicative hiding (many)+import Control.Monad import CoreMonad import Data.Attoparsec.Char8 import Data.Attoparsec.Enumerator@@ -16,12 +17,15 @@ ---------------------------------------------------------------- +importDirs :: [String]+importDirs = ["..","../..","../../..","../../../..","../../../../.."]+ initializeGHC :: Options -> FilePath -> [String] -> Bool -> Ghc (FilePath,LogReader) initializeGHC opt fileName ghcOptions logging = do (owdir,mdirfile) <- liftIO getDirs case mdirfile of Nothing -> do- logReader <- initSession opt ghcOptions Nothing logging+ logReader <- initSession opt ghcOptions importDirs logging return (fileName,logReader) Just (cdir,cfile) -> do midirs <- parseCabalFile cfile@@ -30,7 +34,7 @@ Nothing -> [cdir,owdir] Just dirs -> dirs ++ [owdir] file = ajustFileName fileName owdir cdir- logReader <- initSession opt ghcOptions (Just idirs) logging+ logReader <- initSession opt ghcOptions idirs logging return (file,logReader) ----------------------------------------------------------------@@ -78,8 +82,9 @@ cabalDir :: FilePath -> IO (Maybe (FilePath,FilePath)) cabalDir dir = do- cnts <- getDirectoryContents dir- case filter isCabal cnts of+ cnts <- (filter isCabal <$> getDirectoryContents dir)+ >>= filterM (\file -> doesFileExist (dir </> file))+ case cnts of [] -> do let dir' = takeDirectory dir if dir' == dir
GHCMod.hs view
@@ -21,7 +21,7 @@ ---------------------------------------------------------------- usage :: String-usage = "ghc-mod version 0.6.1\n"+usage = "ghc-mod version 0.6.2\n" ++ "Usage:\n" ++ "\t ghc-mod list [-l]\n" ++ "\t ghc-mod lang [-l]\n"
Types.hs view
@@ -31,22 +31,23 @@ initSession0 opt = getSessionDynFlags >>= setSessionDynFlags . setPackageConfFlags opt -initSession :: Options -> [String] -> Maybe [FilePath] -> Bool -> Ghc LogReader-initSession opt cmdOpts midirs logging = do+initSession :: Options -> [String] -> [FilePath] -> Bool -> Ghc LogReader+initSession opt cmdOpts idirs logging = do dflags <- getSessionDynFlags let opts = map noLoc cmdOpts (dflags',_,_) <- parseDynamicFlags dflags opts- (dflags'',readLog) <- liftIO . setLogger logging . setPackageConfFlags opt . setFlags dflags' $ midirs+ (dflags'',readLog) <- liftIO . setLogger logging . setPackageConfFlags opt . setFlags dflags' $ idirs setSessionDynFlags dflags'' return readLog ---------------------------------------------------------------- -setFlags :: DynFlags -> Maybe [FilePath] -> DynFlags-setFlags d midirs = maybe d' (\x -> d' { importPaths = x }) midirs+setFlags :: DynFlags -> [FilePath] -> DynFlags+setFlags d idirs = d' where d' = d { packageFlags = ghcPackage : packageFlags d+ , importPaths = idirs , ghcLink = NoLink , hscTarget = HscInterpreted }
elisp/ghc.el view
@@ -33,6 +33,11 @@ ;;; Customize Variables ;;; +(defun ghc-find-C-h ()+ (if keyboard-translate-table+ (aref keyboard-translate-table ?\C-h)+ ?\C-h))+ (defvar ghc-completion-key "\e\t") (defvar ghc-document-key "\e\C-d") (defvar ghc-import-key "\e\C-m")@@ -45,6 +50,7 @@ (defvar ghc-info-key "\C-c\C-i") (defvar ghc-check-key "\C-x\C-s") (defvar ghc-toggle-key "\C-c\C-c")+(defvar ghc-hoogle-key (format "\C-c%c" (ghc-find-C-h))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;@@ -68,6 +74,7 @@ (define-key haskell-mode-map ghc-sort-key 'ghc-sort-lines) (define-key haskell-mode-map ghc-check-key 'ghc-save-buffer) (define-key haskell-mode-map ghc-toggle-key 'ghc-flymake-toggle-command)+ (define-key haskell-mode-map ghc-hoogle-key 'haskell-hoogle) (ghc-comp-init) (setq ghc-initialized t)))
ghc-mod.cabal view
@@ -1,5 +1,5 @@ Name: ghc-mod-Version: 0.6.1+Version: 0.6.2 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3