diff options
author | tv <tv@shackspace.de> | 2015-01-31 15:51:57 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-01-31 15:51:57 +0100 |
commit | ef48d081dfd0e817c4959dbbd49929ae760a310e (patch) | |
tree | 54867be238b6f8707a43fa7af6d16d3f59144f73 /test5.hs | |
parent | 39e76d0c83515a98f84f06b1c3b430d1e67cd1cd (diff) |
Notmuch: replace {un,}setTag by notmuchTag
Diffstat (limited to 'test5.hs')
-rw-r--r-- | test5.hs | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -422,18 +422,28 @@ toggleFold q@State{..} = toggleTagAtCursor :: Tag -> State -> IO State toggleTagAtCursor tag q@State{..} = case Z.label cursor of + + TVSearchResult sr -> do + let tagOp = + if tag `elem` Notmuch.searchTags sr + then DelTag + else AddTag + tagOps = [tagOp tag] + Notmuch.notmuchTag tagOps sr + -- TODO reload or patch whole thread + let cursor' = Z.modifyTree (patchRootLabelTags tagOps) cursor + return q { cursor = cursor' } + TVMessage m -> do -- TODO modify search result tags - -- TODO check Notmuch.{set,unset}Tag result - if tag `elem` Notmuch.messageTags m - then do - Notmuch.unsetTag (T.unpack tag) (Notmuch.unMessageID $ Notmuch.messageId m) - let cursor' = Z.modifyTree (patchRootLabelTags [DelTag tag]) cursor - return q { cursor = cursor' } - else do - Notmuch.setTag (T.unpack tag) (Notmuch.unMessageID $ Notmuch.messageId m) - let cursor' = Z.modifyTree (patchRootLabelTags [AddTag tag]) cursor - return q { cursor = cursor' } + let tagOp = + if tag `elem` Notmuch.messageTags m + then DelTag + else AddTag + tagOps = [tagOp tag] + Notmuch.notmuchTag tagOps m + let cursor' = Z.modifyTree (patchRootLabelTags tagOps) cursor + return q { cursor = cursor' } _ -> return q { flashMessage = "nothing happened" } |