packages feed

yi-core 0.13.7 → 0.14.0

raw patch · 22 files changed

+31/−204 lines, 22 filesdep −Hclipdep −exceptionsdep −safe

Dependencies removed: Hclip, exceptions, safe, word-trie

Files

src/System/CanonicalizePath.hs view
@@ -12,7 +12,6 @@ -- System.Directory.canonicalizePath replacement module System.CanonicalizePath   ( canonicalizePath-  , normalisePath   , replaceShorthands   ) where @@ -31,13 +30,6 @@ import           System.FilePath          (isAbsolute, isDrive, pathSeparator,                                            pathSeparators, takeDirectory, (</>)) import           System.PosixCompat.Files (readSymbolicLink)---- | Removes `/./` `//` and `/../` sequences from path,--- doesn't follow symlinks-normalisePath :: FilePath -> IO FilePath-normalisePath path = do-  absPath <- makeAbsolute path-  return $ foldl combinePath "/" $ splitPath absPath  -- | Returns absolute name of the file, which doesn't contain -- any `/./`, `/../`, `//` sequences or symlinks
src/Yi.hs view
@@ -20,7 +20,6 @@ module Yi   (     module Data.Prototype, -- prototypes are mainly there for config; makes sense to export them.-    module Yi.Boot,     module Yi.Buffer,     module Yi.Config,     module Yi.Config.Default,@@ -38,7 +37,6 @@   ) where  import Data.Prototype-import Yi.Boot import Yi.Buffer import Yi.Config import Yi.Config.Default
− src/Yi/Boot.hs
@@ -1,97 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module      :  Yi.Boot--- License     :  GPL-2--- Maintainer  :  yi-devel@googlegroups.com--- Stability   :  experimental--- Portability :  portable------ Boot process of Yi.------ Uses Dyre to implement the XMonad-style dynamic reconfiguration.--module Yi.Boot (yi, yiDriver, yiDriver', reload) where--import qualified Config.Dyre as Dyre-import qualified Config.Dyre.Options as Dyre-import qualified Config.Dyre.Params as Dyre-import           Config.Dyre.Relaunch-import           Lens.Micro.Platform-import           Data.Text ()-import qualified Data.Text.IO as T (putStrLn)-import           System.Environment-import           System.Exit-import           Yi.Boot.Internal-import           Yi.Buffer.Misc (BufferId(..))-import           Yi.Config-import           Yi.Editor-import           Yi.Keymap-import           Yi.Main-import           Yi.Option (OptionError(..))-import           Yi.Paths (getCustomConfigPath)-import           Yi.Rope (fromString)---- | Once the custom yi is compiled this restores the editor state (if--- requested) then proceeds to run the editor.-realMain :: (Config, ConsoleConfig) -> IO ()-realMain configs = restoreBinaryState Nothing >>= main configs---- | If the custom yi compile produces errors or warnings then the--- messages are presented as a separate activity in the editor.------ The use of a separate activity prevents any other initial actions--- from immediately masking the output.-showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)-showErrorsInConf c errs = c & _1 . initialActionsA %~ (makeAction openErrBuf :)-  where-    openErrBuf = splitE >> newBufferE (MemBuffer "*errors*") (fromString errs)---- | Handy alias for 'yiDriver'.-yi :: Config -> IO ()-yi = yiDriver---- | Called from the yi built with the user's configuration. Does not--- ignore unknown arguments.-yiDriver :: Config -> IO ()-yiDriver = yiDriver' False---- | Used by both the yi executable and the custom yi that is built--- from the user's configuration. The yi executable uses a default--- config.-yiDriver' :: Bool -> Config -> IO ()-yiDriver' ignoreUnknownArgs cfg = do-  args <- Dyre.withDyreOptions Dyre.defaultParams getArgs-  -- we do the arg processing before dyre, so we can extract-  -- '--ghc-option=' and '--help' and so on.-  case do_args ignoreUnknownArgs cfg args of-    Left (OptionError err code) -> T.putStrLn err >> exitWith code-    Right (finalCfg, cfgcon) -> do-      modules <- getCustomConfigPath (userConfigDir cfgcon) "modules"-      let yiParams = Dyre.defaultParams-                      { Dyre.projectName  = "yi"-                      , Dyre.realMain     = realMain-                      , Dyre.showError    = showErrorsInConf-                      , Dyre.configDir    = Just $ userConfigDir cfgcon-                      , Dyre.ghcOpts      = ["-threaded", "-O2", "-rtsopts"]-                                            ++ ["-i" ++ modules]-                                            ++ profilingParams-                                            ++ ghcOptions cfgcon-                      , Dyre.includeCurrentDirectory = False-                      , Dyre.rtsOptsHandling = Dyre.RTSAppend ["-I5"]-                      }-      Dyre.wrapMain yiParams (finalCfg, cfgcon)---- | CPP-guarded profiling params.-profilingParams :: [String]-profilingParams =-#ifdef EVENTLOG-  ["-eventlog", "-rtsopts"] ++-#endif-#ifdef PROFILING-  ["-prof", "-auto-all", "-rtsopts"-  , "-osuf=p_o", "-hisuf=p_hi"] ++-#endif-  []
− src/Yi/Boot/Internal.hs
@@ -1,30 +0,0 @@-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module      :  Yi.Boot.Internal--- License     :  GPL-2--- Maintainer  :  yi-devel@googlegroups.com--- Stability   :  experimental--- Portability :  portable------ Internal use for Yi.Boot--module Yi.Boot.Internal where--import Config.Dyre.Relaunch (relaunchWithBinaryState)-import Control.Monad.Base   (liftBase)-import Control.Monad.State  (get)-import Yi.Keymap            (YiM, withUI)-import Yi.Types             (withEditor)-import Yi.UI.Common         (end)---- | "reloads" the configuration------ Serializes the editor state and relaunches Yi using the serialized--- state. The launch of Yi will result in recompilation of the user's--- custom Yi. This, in effect, "reloads" the configuration.-reload :: YiM ()-reload = do-  editor <- withEditor get-  withUI (`end` False)-  liftBase $ relaunchWithBinaryState (Just editor) Nothing
src/Yi/Buffer/Implementation.hs view
@@ -24,17 +24,16 @@   , Update (..)   , updateIsDelete   , Point-  , Mark, MarkValue(..)+  , Mark, MarkValue (..)   , Size   , Direction (..)-  , BufferImpl(..)+  , BufferImpl (mem, marks, markNames, hlCache, overlays, dirtyOffset)   , Overlay (..)   , mkOverlay   , overlayUpdate   , applyUpdateI   , isValidUpdate   , reverseUpdateI-  , nelemsBI   , sizeBI   , newBI   , solPoint@@ -62,7 +61,6 @@   , SearchExp   , markPointAA   , markGravityAA-  , mem   ) where  import           GHC.Generics        (Generic)
src/Yi/Buffer/Indent.hs view
@@ -38,7 +38,6 @@ import           Yi.Buffer.Basic     (Direction (..)) import           Yi.Buffer.HighLevel (firstNonSpaceB, getNextLineB, getNextNonBlankLineB, moveToSol, readLnB) import           Yi.Buffer.Misc-import           Yi.Buffer.Normal    () import           Yi.Buffer.Region    (Region (regionStart), mkRegion, modifyRegionB, readRegionB) import           Yi.Buffer.TextUnit  (regionWithTwoMovesB) import           Yi.Rope             (YiString)
src/Yi/Buffer/Misc.hs view
@@ -224,7 +224,7 @@ import           Yi.Buffer.Implementation import           Yi.Buffer.Undo import           Yi.Interact                    as I (P (End))-import           Yi.Monad                       (getsAndModify)+import           Yi.Monad                       (getsAndModify, uses) import           Yi.Region                      (Region, mkRegion) import           Yi.Rope                        (YiString) import qualified Yi.Rope                        as R@@ -232,9 +232,6 @@ import           Yi.Types import           Yi.Utils                       (SemiNum ((+~)), makeClassyWithSuffix, makeLensesWithSuffix) import           Yi.Window                      (Window (width, wkey, actualLines), dummyWindow)---uses l f = f <$> use l  -- In addition to Buffer's text, this manages (among others): --  * Log of updates mades
src/Yi/Buffer/Region.hs view
@@ -130,7 +130,6 @@ linesOfRegionB :: Region -> BufferM [Region] linesOfRegionB region = do     let start = regionStart region-        end = regionEnd region         direction = regionDirection region     ls <- R.lines' <$> readRegionB region     return $ case ls of
src/Yi/Buffer/Undo.hs view
@@ -57,7 +57,6 @@    ) where  import           Data.Binary              (Binary (..))-import           Data.Monoid import qualified Data.Sequence as S import           GHC.Generics             (Generic) import           Yi.Buffer.Implementation@@ -147,7 +146,7 @@     where       -- Apply a /valid/ update and also move point in buffer to update position       applyUpdateWithMoveI :: Update -> BufferImpl syntax -> BufferImpl syntax-      applyUpdateWithMoveI u = case updateDirection u of+      applyUpdateWithMoveI upd = case updateDirection upd of                                  Forward ->  apply . move                                  Backward -> move . apply           where move = modifyMarkBI pointMark (\v -> v {markPoint = updatePoint u})
src/Yi/CompletionTree.hs view
@@ -177,9 +177,9 @@   | mempty == ct = []   | otherwise = toList' ct   where-    toList' (CompletionTree ct)-      | M.null ct = [mempty]-      | otherwise = concat $ M.elems $ M.mapWithKey (\k v -> map (k `LL.append`) $ toList' v) ct+    toList' (CompletionTree ct')+      | M.null ct' = [mempty]+      | otherwise = concat $ M.elems $ M.mapWithKey (\k v -> map (k `LL.append`) $ toList' v) ct'  -- TODO: make this function display a tree and rename to showTree -- | For debugging purposes.
src/Yi/Config/Simple.hs view
@@ -22,6 +22,7 @@ -- -- @ -- import Yi.Config.Simple+-- import Yi.Boot -- import qualified Yi.Mode.Haskell as Haskell -- -- note: don't import "Yi", or else there will be name clashes --@@ -45,7 +46,6 @@ module Yi.Config.Simple (   -- * The main interface   ConfigM,-  configMain,   Field,   -- * Modes, commands, and keybindings   globalBindKeys,@@ -98,7 +98,6 @@    -- we can't just export 'module Yi', because then we would get   -- clashes with Yi.Config-  module Yi.Boot,   module Yi.Buffer,   module Yi.Core,   module Yi.Dired,@@ -120,7 +119,6 @@ import qualified Data.Text as T import qualified Data.Sequence as S import           Text.Printf(printf)-import           Yi.Boot import           Yi.Buffer hiding (modifyMode) import           Yi.Config.Default import           Yi.Config.Misc@@ -156,11 +154,6 @@  --------------- Main interface -- newtype ConfigM a   (imported)---- | Starts with the given initial config, makes the described--- modifications, then starts yi.-configMain :: Config -> ConfigM () -> IO ()-configMain c m = yi =<< execStateT (runConfigM m) c  ------------------------- Modes, commands, and keybindings -- | Adds the given key bindings to the `global keymap'. The bindings
src/Yi/Core.hs view
@@ -85,7 +85,7 @@ import           Yi.Keymap import           Yi.Keymap.Keys import           Yi.KillRing                    (krEndCmd)-import           Yi.Monad                       (gets)+import           Yi.Monad                       (gets, uses) import           Yi.PersistentState             (loadPersistentState, savePersistentState) import           Yi.Process import qualified Yi.Rope                        as R (YiString, fromString, readFile)@@ -95,8 +95,6 @@ import           Yi.Utils                       (io) import           Yi.Window                      (bufkey, dummyWindow, isMini, winRegion, wkey) --uses l f = f <$> use l -- | Make an action suitable for an interactive run. -- UI will be refreshed. interactive :: IsRefreshNeeded -> [Action] -> YiM ()
src/Yi/Editor.hs view
@@ -102,12 +102,11 @@  import           Lens.Micro.Platform            (Lens', lens, mapped,                                                  use, view, (%=), (%~),-                                                 (&), (.~), (^.), (.=),-                                                 ASetter)+                                                 (&), (.~), (^.)) import           Control.Monad                  (forM_, liftM) import           Control.Monad.Reader           (MonadReader (ask), asks,                                                  unless, when)-import           Control.Monad.State            (gets, modify, MonadState)+import           Control.Monad.State            (gets, modify) import           Data.Binary                    (Binary, get, put) import           Data.Default                   (Default, def) import qualified Data.DelayList                 as DelayList (insert)@@ -137,7 +136,7 @@ import           Yi.JumpList                    (Jump (..), JumpList, addJump, jumpBack, jumpForward) import           Yi.KillRing                    (krEmpty, krGet, krPut, krSet) import           Yi.Layout-import           Yi.Monad                       (getsAndModify)+import           Yi.Monad                       (assign, getsAndModify, uses) import           Yi.Rope                        (YiString, empty, fromText) import qualified Yi.Rope                        as R (YiString, fromText, snoc) import           Yi.String                      (listify)@@ -146,11 +145,6 @@ import           Yi.Types import           Yi.Utils import           Yi.Window--assign :: MonadState s m => ASetter s s a b -> b -> m ()-assign = (.=)--uses l f = f <$> use l  instance Binary Editor where   put (Editor bss bs supply ts dv _sl msh kr regex _dir _ev _cwa ) =
src/Yi/Eval.hs view
@@ -42,7 +42,7 @@ import Prelude hiding (mapM_)  import Lens.Micro.Platform ( (^.), (.=), (%=) )-import Control.Monad (when, void, forever)+import Control.Monad (when) import Data.Array ( elems ) import Data.Binary ( Binary ) import Data.Default ( Default, def )
src/Yi/MiniBuffer.hs view
@@ -10,6 +10,7 @@ {-# LANGUAGE TypeSynonymInstances       #-} {-# LANGUAGE UndecidableInstances       #-} {-# OPTIONS_HADDOCK show-extensions #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}  -- | -- Module      :  Yi.Minibuffer
src/Yi/Monad.hs view
@@ -1,8 +1,10 @@ module Yi.Monad (+                 assign,                  gets,                  getsAndModify,                  maybeM,                  repeatUntilM,+                 uses,                  whenM,                  with,                 ) where@@ -10,6 +12,7 @@ import Control.Monad.Base   (MonadBase, liftBase) import Control.Monad.Reader (MonadReader, ask) import Control.Monad.State  (MonadState, get, gets, put, when)+import Lens.Micro.Platform (Getting, ASetter, (.=), use)  -- | Combination of the Control.Monad.State 'modify' and 'gets' getsAndModify :: MonadState s m => (s -> (s,a)) -> m a@@ -39,3 +42,9 @@     then (do xs <- repeatUntilM m               return (x:xs))     else return [x]++assign :: MonadState s m => ASetter s s a b -> b -> m ()+assign = (.=)++uses :: MonadState s m => Getting a s a -> (a -> b) -> m b+uses l f = f <$> use l
src/Yi/Syntax/Tree.hs view
@@ -41,10 +41,9 @@ import           Data.Monoid         (First (First, getFirst), Last (Last, getLast), (<>)) import           Yi.Buffer.Basic     (Point) import           Yi.Debug            (error, trace)-import           Yi.Lexer.Alex       (Posn (Posn, posnLine, posnOfs),-                                      Tok (Tok, tokPosn), tokBegin, tokEnd)-import           Yi.Region           (Region (regionEnd, regionStart),-                                      includedRegion, mkRegion)+import           Yi.Lexer.Alex       (posnLine, posnOfs,+                                      Tok (tokPosn), tokBegin, tokEnd)+import           Yi.Region           (Region (regionEnd, regionStart), mkRegion) import           Yi.String           (showT)  #ifdef TESTING
src/Yi/Tag.hs view
@@ -41,8 +41,8 @@ import qualified Data.Foldable          as F (concat) import           Data.Map               (Map, fromListWith, keys, lookup) import           Data.Maybe             (mapMaybe)-import qualified Data.Text              as T (Text, append, isPrefixOf, lines, pack, unpack, words)-import qualified Data.Text.Encoding     as E (decodeUtf8, encodeUtf8)+import qualified Data.Text              as T (Text, append, isPrefixOf, lines, unpack, words)+import qualified Data.Text.Encoding     as E (decodeUtf8) import qualified Data.Text.Read         as R (decimal) import qualified Yi.CompletionTree      as CT import           System.FilePath        (takeDirectory, takeFileName, (</>))
test/Yi/CompletionTests.hs view
@@ -1,13 +1,11 @@ module Yi.CompletionTests (testSuite) where -import Data.List (sort,nub) import Data.Maybe(isJust) import Data.Monoid import Data.Text.Arbitrary() import Test.Tasty import Test.Tasty.QuickCheck import Yi.Completion as C-import qualified Data.Map as M import qualified Data.Text as T  testSuite :: TestTree
test/Yi/Mode/CommonTests.hs view
@@ -2,7 +2,6 @@ module Yi.Mode.CommonTests (testSuite) where  import Test.Tasty-import Test.Tasty.QuickCheck import Test.Tasty.HUnit  import Yi.Mode.Common
test/Yi/TagTests.hs view
@@ -2,7 +2,6 @@ module Yi.TagTests (testSuite) where  import Test.Tasty-import Test.Tasty.QuickCheck import Test.Tasty.HUnit  import Yi.Tag
yi-core.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           yi-core-version:        0.13.7+version:        0.14.0 synopsis:       Yi editor core library category:       Yi homepage:       https://github.com/yi-editor/yi#readme@@ -52,11 +52,8 @@     , directory     , dlist >= 0.4.1     , dynamic-state >= 0.1.0.5-    , dyre >= 0.8.11-    , exceptions     , filepath >= 1.1     , hashable >= 1.1.2.5-    , Hclip >= 3     , ListLike >= 4.5     , microlens-platform     , mtl >= 0.1.0.1@@ -66,8 +63,6 @@     , pointedlist >= 0.5     , process >= 1.0.1.1     , process-extras >= 0.3.3.8-    , safe >= 0.3.4-    , semigroups     , split >= 0.2     , text >= 1.1.1.3     , text-icu >= 0.7@@ -75,10 +70,11 @@     , transformers-base     , unix-compat >= 0.1     , unordered-containers >= 0.1.3-    , word-trie >= 0.2.0.4     , xdg-basedir >= 0.2.1     , yi-language >= 0.1.1.0     , yi-rope >= 0.7.0.0+    , semigroups+    , dyre >= 0.8.11   if os(win32)     build-depends:         Win32@@ -101,8 +97,6 @@       , random   exposed-modules:       Yi-      Yi.Boot-      Yi.Boot.Internal       Yi.Buffer       Yi.Buffer.Adjusted       Yi.Buffer.HighLevel@@ -194,11 +188,8 @@     , directory     , dlist >= 0.4.1     , dynamic-state >= 0.1.0.5-    , dyre >= 0.8.11-    , exceptions     , filepath >= 1.1     , hashable >= 1.1.2.5-    , Hclip >= 3     , ListLike >= 4.5     , microlens-platform     , mtl >= 0.1.0.1@@ -208,8 +199,6 @@     , pointedlist >= 0.5     , process >= 1.0.1.1     , process-extras >= 0.3.3.8-    , safe >= 0.3.4-    , semigroups     , split >= 0.2     , text >= 1.1.1.3     , text-icu >= 0.7@@ -217,7 +206,6 @@     , transformers-base     , unix-compat >= 0.1     , unordered-containers >= 0.1.3-    , word-trie >= 0.2.0.4     , xdg-basedir >= 0.2.1     , yi-language >= 0.1.1.0     , yi-rope >= 0.7.0.0@@ -258,11 +246,8 @@     , directory     , dlist >= 0.4.1     , dynamic-state >= 0.1.0.5-    , dyre >= 0.8.11-    , exceptions     , filepath >= 1.1     , hashable >= 1.1.2.5-    , Hclip >= 3     , ListLike >= 4.5     , microlens-platform     , mtl >= 0.1.0.1@@ -272,8 +257,6 @@     , pointedlist >= 0.5     , process >= 1.0.1.1     , process-extras >= 0.3.3.8-    , safe >= 0.3.4-    , semigroups     , split >= 0.2     , text >= 1.1.1.3     , text-icu >= 0.7@@ -281,7 +264,6 @@     , transformers-base     , unix-compat >= 0.1     , unordered-containers >= 0.1.3-    , word-trie >= 0.2.0.4     , xdg-basedir >= 0.2.1     , yi-language >= 0.1.1.0     , yi-rope >= 0.7.0.0