Fri Dec 5 15:43:14 EST 2008 [EMAIL PROTECTED] * Yi.IReader: enumerate imports
Fri Dec 5 16:25:23 EST 2008 [EMAIL PROTECTED] * Yi.IReader: convert to bytestring Because of 'read' and 'show' (and the concomitant packing and unpack), this probably doesn't gain much speed or space. But it gets us strict file I/O without copy-pasta. --~--~---------~--~----~------------~-------~--~----~ Yi development mailing list [email protected] http://groups.google.com/group/yi-devel -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 New patches: [Yi.IReader: enumerate imports [EMAIL PROTECTED] Ignore-this: 880f4849ee13314db9bb849c35092d93 ] hunk ./Yi/IReader.hs 8 -- \"incremental reading\", see <http://en.wikipedia.org/wiki/Incremental_reading>. module Yi.IReader where - -import Control.Monad.State - -import Data.List +import Control.Monad.State (join, liftM) +import Data.List (delete) import System.Directory (getHomeDirectory) hunk ./Yi/IReader.hs 12 - -import Yi.Keymap - -import Yi.Prelude - -import Yi.Buffer.Misc - -import Yi.Buffer.Region - -import Yi.Buffer.Normal - -import Yi.Buffer.HighLevel +import Yi.Keymap (withBuffer, YiM) +import Yi.Prelude (io) +import Yi.Buffer.Misc (BufferM) +import Yi.Buffer.Region (readRegionB) +import Yi.Buffer.Normal (regionOfB, TextUnit(Document)) +import Yi.Buffer.HighLevel (replaceBufferContent, topB) import qualified System.IO as IO type Article = String [Yi.IReader: convert to bytestring [EMAIL PROTECTED] Ignore-this: ab92a8c32d6ae461c8953c90138f0527 Because of 'read' and 'show' (and the concomitant packing and unpack), this probably doesn't gain much speed or space. But it gets us strict file I/O without copy-pasta. ] hunk ./Yi/IReader.hs 9 module Yi.IReader where import Control.Monad.State (join, liftM) - -import Data.List (delete) import System.Directory (getHomeDirectory) import Yi.Keymap (withBuffer, YiM) hunk ./Yi/IReader.hs 17 import Yi.Buffer.Region (readRegionB) import Yi.Buffer.Normal (regionOfB, TextUnit(Document)) import Yi.Buffer.HighLevel (replaceBufferContent, topB) - -import qualified System.IO as IO +import qualified Data.ByteString.Char8 as B (empty, pack, unpack, readFile, writeFile, ByteString) hunk ./Yi/IReader.hs 19 - -type Article = String - -type ArticleDB = [String] +type Article = B.ByteString +type ArticleDB = [B.ByteString] -- | Get the first article in the list. We use the list to express relative priority; -- the first is the most, the last least. We then just cycle through - every article gets equal time. hunk ./Yi/IReader.hs 25 getLatestArticle :: ArticleDB -> Article - -getLatestArticle [] = "" +getLatestArticle [] = B.empty getLatestArticle adb = head adb -- | We remove the old first article, and we stick it on the end of the hunk ./Yi/IReader.hs 38 insertArticle :: ArticleDB -> Article -> ArticleDB insertArticle = flip (:) - --- | Delete the first - -deleteArticle :: ArticleDB -> Article -> ArticleDB - -deleteArticle = flip delete - - -- | Serialize given 'ArticleDB' out. writeDB :: ArticleDB -> YiM () hunk ./Yi/IReader.hs 40 - -writeDB adb = io $ join $ liftM (flip writeFile $ show adb) $ dbLocation +writeDB adb = io $ join $ liftM (flip B.writeFile $ B.pack $ show adb) $ dbLocation -- | Read in database from 'dbLocation' and then parse it into an 'ArticleDB'. readDB :: YiM ArticleDB hunk ./Yi/IReader.hs 44 - -readDB = io $ rddb `catch` (\_ -> return (return [])) - - where rddb = do db <- liftM readfile $ dbLocation - - liftM read db - - -- We need these for strict IO - - readfile :: FilePath -> IO String - - readfile f = IO.openFile f IO.ReadMode >>= hGetContents - - hGetContents :: IO.Handle -> IO.IO String - - hGetContents h = IO.hGetContents h >>= \s -> length s `seq` return s +readDB = io $ rddb `catch` (\_ -> return [B.empty]) + where rddb = do db <- liftM B.readFile $ dbLocation + liftM (read . B.unpack) db -- | The canonical location. We assume \~\/.yi has been set up already. dbLocation :: IO FilePath hunk ./Yi/IReader.hs 56 oldDbNewArticle :: YiM (ArticleDB, Article) oldDbNewArticle = do olddb <- readDB newarticle <- withBuffer getBufferContents - - return (olddb, newarticle) + return (olddb, B.pack newarticle) getBufferContents :: BufferM String getBufferContents = readRegionB =<< regionOfB Document hunk ./Yi/IReader.hs 64 -- | Given an 'ArticleDB', dump the scheduled article into the buffer (replacing previous contents). setDisplayedArticle :: ArticleDB -> YiM () setDisplayedArticle newdb = do let nextarticle = getLatestArticle newdb - - withBuffer (replaceBufferContent nextarticle) + withBuffer (replaceBufferContent (B.unpack nextarticle)) withBuffer topB -- replaceBufferContents moves us -- to bottom? hunk ./Yi/IReader.hs 79 -- | Delete current article (the article as in the database), and go to next one. deleteAndNextArticle :: YiM () - -deleteAndNextArticle = do ((_:ndb),_) <- oldDbNewArticle -- throw away changes, drop head +deleteAndNextArticle = do ((_:ndb),_) <- oldDbNewArticle -- throw away changes, + -- drop 1st article setDisplayedArticle ndb writeDB ndb Context: [Vim: use const instead of \_-> Nicolas Pouillard <[EMAIL PROTECTED]>**20081205183023 Ignore-this: 963f359f4dfdd490cae6823c13d05b44 ] [Force-operation chaining (eg. dVvvVvvVvj) Krzysztof Goj <[EMAIL PROTECTED]>**20081205172128] [forcing RegionStyle Krzysztof Goj <[EMAIL PROTECTED]>**20081205164440] [Vim: better handling of extra spaces when using minibuffer (:e...) Nicolas Pouillard <[EMAIL PROTECTED]>**20081205104507 Ignore-this: c2421a4ce3f3c0fa948a1d4028e2927e ] [Vim: don't leftOnEol in the minibuffer. Nicolas Pouillard <[EMAIL PROTECTED]>**20081205101252 Ignore-this: 25d2a1737e7f75e6d0d41f19a0df4a36 ] [Optimize going to begin of line. Nicolas Pouillard <[EMAIL PROTECTED]>**20081205094727 Ignore-this: e9edc3fb2ede3cdac0a096d9367423ac ] [Vim: add :nohlsearch,:noh to reset the current search. Nicolas Pouillard <[EMAIL PROTECTED]>**20081205093930 Ignore-this: 77fc9e61e12a04cba2a6523dcc35395d ] [Yi.Search: add resetRegexE. Nicolas Pouillard <[EMAIL PROTECTED]>**20081205093855 Ignore-this: d324123e57013fc9ded8b11a84d85c7b ] [Vim: more leftOnEol fixes. Nicolas Pouillard <[EMAIL PROTECTED]>**20081205092513 Ignore-this: 8195b31b4126d05722f0f197591acb45 ] [Fixes 'c$' and 'C' in normal mode Krzysztof Goj <[EMAIL PROTECTED]>**20081205010649] [Lexer.GNUMake: Adding a test of mixing bracket styles in a variable expansion [EMAIL PROTECTED] [Lexer.GNUMake: Adding recursive variable expansion as required by function calls [EMAIL PROTECTED] [Adding a test for use of $$ as a variable identifier. [EMAIL PROTECTED] [Lexer.GNUMake: Rule commands can contain variable expansion [EMAIL PROTECTED] [Lexer.GNUMake: Handle $$ correctly [EMAIL PROTECTED] [Adding a test of $$ to escape a variable expansion [EMAIL PROTECTED] [Lexer.GNUMake: Add support for '\' continueing a rule command [EMAIL PROTECTED] [Lexer.GNUMake: Small additions. [EMAIL PROTECTED] [Lexer.GNUMake: Adding to test data [EMAIL PROTECTED] [Lexer.GNUMake: Expansions of variables with single character names [EMAIL PROTECTED] [Lexer.GNUMake: Start of variable expansion parsing [EMAIL PROTECTED] [Style.Library.darkBlueTheme: cyan for variables. Operators should be brown. [EMAIL PROTECTED] [Vim: systematic and localised leftOnEol rule. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204225652 Ignore-this: 793b88201c1f7b05fd5f2bf7a4399be9 ] [Vim: a bunch of style changes. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204225639 Ignore-this: 8bfe306f46da28f1bcf0d5ff8889d5b1 ] [Vim: fix more cutting+adjBlock Nicolas Pouillard <[EMAIL PROTECTED]>**20081204203501 Ignore-this: bb11a79597f31265a4e62cfcb9c563d5 ] [Vim: "J" doesn't cut the newline it replace it by a space. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204203257 Ignore-this: 800eb5d71bdd6eedd74cd4cad608006d ] [Lexer.GNUMake: Adding basic include directive support [EMAIL PROTECTED] [Adding more include directive test cases to Makefile lexer test data [EMAIL PROTECTED] [Adding include directive tests to Makefile lexer test data [EMAIL PROTECTED] [Vim: replace z+ by z<CR> and save the current column. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204171358 Ignore-this: 3f73bbedc7e2d02b5b35d907ad4c1f7d ] [Vim: use moveToColB for N| command. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204171332 Ignore-this: 56f99d9b7ddffb93ea19459e3dd023c5 ] [Buffer: wall and style. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204170727 Ignore-this: 452d30e302e2114620e712a100283817 ] [Buffer: refactor lineMoveRel, add moveToColB, movingToPrefCol and solPointB Nicolas Pouillard <[EMAIL PROTECTED]>**20081204170427 Ignore-this: 38655198619a876821f1fafb0219d4a4 ] [More scrolling Krzysztof Goj <[EMAIL PROTECTED]>**20081204025147 Normal mode: zz zt zb z. z+ z- Insert mode: ^y ^e ] [Vim: fix multiline cutting/pasting w.r.t. adjBlock. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204154310 Ignore-this: 5a7a134165571142cec59f93187cea06 ] [Vim: N% move now go to first non space. Nicolas Pouillard <[EMAIL PROTECTED]>**20081204104245 Ignore-this: 49b00315b215893831191932a388daaf ] [cabal lexer: follow more closely the actual Cabal tool Nicolas Pouillard <[EMAIL PROTECTED]>**20081204103504 Ignore-this: 668b9a8f6589e0dbad8c52f519d239a5 In particular concerning comments. ] [remove a bad usage of List.head [EMAIL PROTECTED] [Yi.IReader: more comments [EMAIL PROTECTED] Ignore-this: c413390c7fd7ae85f76734fa3c5a8b54 ] [Yi/Users/Corey: Replaced hardcoded 4 in KBS handling to be shift width. [EMAIL PROTECTED] [Yi.Users.Corey: minor suggestions Nicolas Pouillard <[EMAIL PROTECTED]>**20081203214045 Ignore-this: c7357f691ea18c8a89db9b3e7293b762 ] [Vim: less parens. Nicolas Pouillard <[EMAIL PROTECTED]>**20081203214311 Ignore-this: 22702b54973afdb5c77d67929452a695 ] [Vim: ":<int>" also have to go to first non space char. Nicolas Pouillard <[EMAIL PROTECTED]>**20081203213806 Ignore-this: 69ee440d16448b21851ddbc06352b37f ] [Vim: improve 'G' code. Nicolas Pouillard <[EMAIL PROTECTED]>**20081203213640 Ignore-this: 8cbd5f1a5c13ca99bc7dc0404563a147 ] ['gg' and 'G' should go to first non-space char of line Krzysztof Goj <[EMAIL PROTECTED]>**20081203212353] [Vim normal mode: "gg" with count argument Krzysztof Goj <[EMAIL PROTECTED]>**20081203203817] [Main.hs: M-x ireadMode to just iread [EMAIL PROTECTED] Ignore-this: b307ff52b630f8500f05218d4a5aa5c0 So I don't need to constantly disambiguate. ] [last of the LANGUAGE pragmas [EMAIL PROTECTED] Ignore-this: 8a1bd56c03682e4c9b163a615263af84 I have cast the extensions field into perdition, and added the missing per-file declarations. ] [Shim/*: +pragmas, rm unused imports [EMAIL PROTECTED] Ignore-this: eff16eba16ed8e3b98fdfe9420f1ab2b ] [fix up Shim/ w/r/t Control.Exception [EMAIL PROTECTED] Ignore-this: 4ec9ae4bafcf9b98c07acd0a6cbab9e ] [Shim/; some -Wall cleanup [EMAIL PROTECTED] Ignore-this: bcfe4c1e2d239472e56d08fe0eee0bd4 ] [Comments fix Krzysztof Goj <[EMAIL PROTECTED]>**20081203155512 - Esc leaves visual mode -- dropping comment - Explain and extend a FIXME for S and C ] [Add Yi.Region.regionIsEmpty Nicolas Pouillard <[EMAIL PROTECTED]>**20081203175753 Ignore-this: c075fd46a14a991d5476770b9faafed7 ] [Vim: do nothing when cuting/pasting empty regions Nicolas Pouillard <[EMAIL PROTECTED]>**20081203155544 Ignore-this: e0b4bc63452e1e2df93b4e3a2a841413 This avoid marking the buffer as unsaved. ] [Vim: style, parens, and trailing white-spaces. Nicolas Pouillard <[EMAIL PROTECTED]>**20081203155350 Ignore-this: 3d959998aed83292f5fac99a7a8d6f44 ] [Vim: when leaving insert/replace mode, use moveXorSol 1 instead of leftB Nicolas Pouillard <[EMAIL PROTECTED]>**20081203155247 Ignore-this: f2766bc3a75501484a524d241f84e025 ] [Corrected 'x' and 'X' behaviour Krzysztof Goj <[EMAIL PROTECTED]>**20081203125741 Now 'x' and 'X' are aliases to dl and dh (as in Vim) -- they cannot delete newline character. ] [Ctrl+h in insert and replace mode; Ctrl+w in replace mode Krzysztof Goj <[EMAIL PROTECTED]>**20081203012614] [Ctrl+h in Ex mode Krzysztof Goj <[EMAIL PROTECTED]>**20081203000017] [Ctrl+p, Ctrl+n in Ex mode Krzysztof Goj <[EMAIL PROTECTED]>**20081202235807] [Vim visual mode: 's' is synonym to 'c' Krzysztof Goj <[EMAIL PROTECTED]>**20081202233509] [Vim: ctrl+u, ctrl+d scrolling Krzysztof Goj <[EMAIL PROTECTED]>**20081202231544] [Behaviour at end of line (BIG PATCH) Krzysztof Goj <[EMAIL PROTECTED]>**20081203031045 - Doesn't allow to go to EOL in normal mode - Does allow it in other (visual, insert, replace) modes - Corrected D, and '$' command - cursor moves left after leaving insert and replace mode ] [Ctrl-t and Ctrl-d in insert mode (indentation) Krzysztof Goj <[EMAIL PROTECTED]>**20081202223751] [Better percent move. Krzysztof Goj <[EMAIL PROTECTED]>**20081202162105] [Issue 202: indentation and Vim commands Krzysztof Goj <[EMAIL PROTECTED]>**20081202183446 Added indentation-awareness to cutRegion, pasteBefore and pasteAfter. ] [Fixed isMakefile: takeBaseName should be takeFileName. Otherwise makefile's named like foo.mk would not be recognized. [EMAIL PROTECTED] [replace all: more helpful message [EMAIL PROTECTED] [fix build [EMAIL PROTECTED] [Better word and WORD motions for Vim keymap. Krzysztof Goj <[EMAIL PROTECTED]>**20081202132813] [doc [EMAIL PROTECTED] [Yi/Users/Gwern.hs: +shorter binding for gotoLn [EMAIL PROTECTED] Ignore-this: 5defc56344c3e1c61bd602d192e06af3 I find the default Emacs binding of M-g g tedious; why not just M-g? ] [doc [EMAIL PROTECTED] [make Accessor instance of Category [EMAIL PROTECTED] [use Control.Category [EMAIL PROTECTED] [Yi.Keymap.Emacs: +standard emacs M-; binding [EMAIL PROTECTED] Ignore-this: 5abf2d7154acfdcce44286f34ec238b9 ] [update to base>=4; replace all Control.Exception with Control.OldException [EMAIL PROTECTED] Ignore-this: 205b7c23a4ffcc16b8612d0b4edc9352 ] [better support for vivid colors [EMAIL PROTECTED] [Main.hs: minor indent [EMAIL PROTECTED] Ignore-this: b53fd55beb556c92b6bba9ee4a49cd61 ] [added C-w and C-u to ex mode Aleksandar Dimitrov <[EMAIL PROTECTED]>**20081201103414] ['ZZ' closes window, not editor, 'ZQ' == ':q!' Aleksandar Dimitrov <[EMAIL PROTECTED]>**20081201103311] [bump version number [EMAIL PROTECTED] [TAG 0.5.2 [EMAIL PROTECTED] Patch bundle hash: 08ea24af5aab063ba25350e3ff3cf95b6b18ee64 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEAREKAAYFAkk5nIcACgkQvpDo5Pfl1oLwXQCfRseRZLbLOquQpsO6u6IV5iz/ e2cAn37gE6DnHYYKXpGISlZ1aCEE/25W =6nrf -----END PGP SIGNATURE-----
