diff options
author | tv <tv@shackspace.de> | 2015-01-11 21:53:13 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-01-11 21:53:13 +0100 |
commit | 5273db3d5c21cd4ef331df57e09c58c93bcc3f46 (patch) | |
tree | dd62e266744497088f2749568b797793e5daf208 /test5.hs | |
parent | df057aa8493de81770576c596fe6a497605481ea (diff) |
notmuch insert reply drafts
Diffstat (limited to 'test5.hs')
-rw-r--r-- | test5.hs | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -4,6 +4,7 @@ module Main (main) where +import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Data.Text.IO as T import qualified Data.Tree as Tree @@ -449,7 +450,30 @@ replyToAll q@State{..} = case getMessage (Z.label cursor) of Plain $ "notmuch exit code = " ++ show code } ExitSuccess -> - runEditor path q + runEditor' path q >>= \case + ExitFailure code -> + return q { flashMessage = Plain $ "editor exit code = " ++ show code } + ExitSuccess -> do + x <- LBS.readFile path + -- TODO use TagOps + Notmuch.notmuchWithInput + [ "insert" + , "--no-hooks" + , "+draft" + -- TODO dont hardcode which tags to delete + , "-inbox" + , "-unread" + ] + -- TODO rename to draftPath + x >>= \case + (ExitFailure code, _, _) -> + return q { flashMessage = + Plain $ "notmuch insert exit code = " ++ show code + } + _ -> + toggleFold q { + flashMessage = "draft created" + } viewSource :: State -> IO State |