Skip to content

Commit

Permalink
Fix :wqa failing with "Buffer not associated with a file."
Browse files Browse the repository at this point in the history
  • Loading branch information
ethercrow committed Dec 15, 2014
1 parent 85558a1 commit 6c34000
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/library/Yi/File.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ module Yi.File (
openNewFile,

viWrite, viWriteTo, viSafeWriteTo,
fwriteE, -- :: YiM ()
fwriteBufferE, -- :: BufferM ()
fwriteAllE, -- :: YiM ()
fwriteToE, -- :: String -> YiM ()
backupE, -- :: FilePath -> YiM ()
revertE, -- :: YiM ()
fwriteE,
fwriteBufferE,
fwriteAllY,
fwriteToE,
backupE,
revertE,

-- * Helper functions
setFileName,
Expand All @@ -35,7 +35,7 @@ module Yi.File (

import Control.Applicative
import Control.Lens hiding (act, Action)
import Control.Monad (when, void)
import Control.Monad (filterM, when, void)
import Control.Monad.Base
import Data.Default
import Data.Monoid
Expand Down Expand Up @@ -169,11 +169,10 @@ fwriteToE f = do
fwriteBufferE b

-- | Write all open buffers
fwriteAllE :: YiM Bool
fwriteAllE =
do allBuffs <- gets bufferSet
let modifiedBuffers = filter (not . isUnchangedBuffer) allBuffs
and <$> mapM fwriteBufferE (fmap bkey modifiedBuffers)
fwriteAllY :: YiM Bool
fwriteAllY = do
modifiedBuffers <- filterM deservesSave =<< gets bufferSet
and <$> mapM fwriteBufferE (fmap bkey modifiedBuffers)

-- | Make a backup copy of file
backupE :: FilePath -> YiM ()
Expand Down
2 changes: 1 addition & 1 deletion src/library/Yi/Keymap/Vim/Ex/Commands/Quit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ quitAllE = do

saveAndQuitAllE :: YiM ()
saveAndQuitAllE = do
succeed <- fwriteAllE
succeed <- fwriteAllY
when succeed quitEditor

0 comments on commit 6c34000

Please sign in to comment.