diff --git a/twander.py b/twander.py index 27bc62c..45f0aea 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.208 2006/12/18 23:50:43 tundra Exp $" +RCSID = "$Id: twander.py,v 3.209 2006/12/19 00:13:16 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -587,6 +587,7 @@ ##### ASSIGN = "=" # Assignment for variable definitions +ASSOCBLANK = "RESETASSOC" # Internally used to indicate a blank ASSOC RHS ASSOCDFLT = "*" # Symbol for default association action ASSOCEXCL = "-" # Symbol for association exclusion action ASSOCIATE = "ASSOC" # Association keyword @@ -1753,6 +1754,11 @@ elif (len(fields[0]) == 1) or (fields[0] == ASSOCIATE): + # Handle the case of association statements w/blank RHS + + if (len(fields) == 2) and (fields[0] == ASSOCIATE): + fields.append(ASSOCBLANK) + # Must have at least 3 fields for a valid command definition if len(fields) < 3: WrnMsg(wBADCFGLINE % (num, line), fn=file) @@ -1769,14 +1775,26 @@ # Store associations for use at execution time if cmdkey == ASSOCIATE: - if cmdname == ASSOCEXCL: + + # Blank RHS implies user wants association removed + + if cmd == ASSOCBLANK: + del UI.Associations[cmdname] + + # Process association exclusions + + elif cmdname == ASSOCEXCL: for exclude in cmd.split(): if exclude not in UI.Associations[cmdname]: # Avoid duplicates UI.Associations[cmdname].append(exclude) + + # Process normal association statements + else: UI.Associations[cmdname] = cmd return + # Add the command entry to the command table. # If the key is a duplicate, the older definition is # overwritten.