From 73cf93d27bf30aef1a19b0971d7e69623aa70c7d Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Sun, 12 Jan 2020 13:34:22 -0500 Subject: [PATCH] Renumber tags when we delete a tagged reminder. --- scripts/tkremind | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/tkremind b/scripts/tkremind index 1fceae90..106ded7f 100755 --- a/scripts/tkremind +++ b/scripts/tkremind @@ -3024,6 +3024,7 @@ proc DeleteTaggedReminder { tag } { set found 0 + set tagno 0 while {[gets $in line] >= 0} { if {[string match "REM TAG $tag *" $line]} { set found 1 @@ -3039,7 +3040,14 @@ proc DeleteTaggedReminder { tag } { if {[string match "# TKEND" $line]} { continue } - puts $out $line + + # Renumber tags + if {[regexp {^REM TAG TKTAG([0-9]+) (.*)$} $line all oldtag rest]} { + incr tagno + puts $out "REM TAG TKTAG$tagno $rest" + } else { + puts $out $line + } } if {! $found } {