summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-01-08 18:17:32 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2012-01-08 18:17:32 +0000
commitc9cd9d36b6103f17a265b334397af88655797e19 (patch)
treef63d07a0086719139310c784ea3abe7e477d218c /alot
parenteabcacdcd64b714edcb89bc40af61f903bc4771a (diff)
add retag command for thread buffer
that tags selection with given tags and removes all other tags from the message(s) issue #236
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/thread.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 3bab332f..07edfefe 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -623,6 +623,9 @@ class ThreadSelectCommand(Command):
@registerCommand(MODE, 'tag', forced={'action': 'add'}, arguments=[
(['--all'], {'action': 'store_true', 'help':'tag all messages in thread'}),
(['tags'], {'help':'comma separated list of tags'})])
+@registerCommand(MODE, 'retag', forced={'action': 'set'}, arguments=[
+ (['--all'], {'action': 'store_true', 'help':'retag all messages in thread'}),
+ (['tags'], {'help':'comma separated list of tags'})])
@registerCommand(MODE, 'untag', forced={'action': 'remove'}, arguments=[
(['--all'], {'action': 'store_true', 'help':'tag all messages in thread'}),
(['tags'], {'help':'comma separated list of tags'})])
@@ -637,8 +640,9 @@ class TagCommand(Command):
:type tags: str
:param all: tag all messages in thread
:type all: bool
- :param action: adds tags if 'add', removes them if 'remove' or toggle
- individually if 'toggle'
+ :param action: adds tags if 'add', removes them if 'remove', adds tags
+ and removes all other if 'set' or toggle individually if
+ 'toggle'
:type action: str
"""
self.tagsstring = tags
@@ -663,6 +667,9 @@ class TagCommand(Command):
for m in messages:
if self.action == 'add':
m.add_tags(tags, afterwards=refresh_widgets)
+ if self.action == 'set':
+ m.add_tags(tags, afterwards=refresh_widgets,
+ remove_rest=True)
elif self.action == 'remove':
m.remove_tags(tags, afterwards=refresh_widgets)
elif self.action == 'toggle':