diff --git a/twander.1 b/twander.1 index a6fc2ec..1338563 100644 --- a/twander.1 +++ b/twander.1 @@ -2819,8 +2819,8 @@ It's easy to fall into the trap of treating the \*(TW configuration capabilities as a real "programming language". It is not, it is a fairly simple macro language that does -very little more than string substitutions. You should thus kee these -rules in mind as you edit your configuration: +very little more than string substitutions. +Keep the following rules in mind as you edit your configuration: .IP \(bu 4 @@ -2829,10 +2829,10 @@ .B until they appear in a Command Definition. .IP \(bu 4 -Option Statements, Key Binding Statements, Directory Shortcut +The Right Hand Side of Option Statements, Key Binding Statements, Directory Shortcut Statements, and Wildcard Statements -.B are treated literally -with no variable substitution ever done to their Right Hand Side. +.B are treated literally - +No variable substitution is ever done there. .IP \(bu 4 A Conditional Statement always involves a variable @@ -2844,6 +2844,21 @@ .B must be defined and any equality test must be satisfied. +.IP \(bu 4 +When testing for the existence of a User-Defined or Environment +Variable, \*(TW does not care what +.B value +the variable contains. It is perfectly permissible to have +either type of variable set to an empty string. The fact +that the variable exists at all is what makes the following +construct true: + +.nf +CondVar = +\&.if [CondVar] + .... +\&.endif + .P Common mistakes include: @@ -2859,17 +2874,15 @@ ##### # Expecting a conditional variable to be resolved before the test # Suppose $EDITOR is set to "/usr/local/bin/emacs" ... -##### - -EDT = [$EDITOR] - -##### +# # The following will be False because [EDT] equals # the string "[$EDITOR]". It is not replaced # with "/usr/local/bin/emacs" until [EDT] appears # in a Command Definition ##### +EDT = [$EDITOR] + \&.if [EDT] == /usr/local/bin/emacs ... \&.endif @@ -2882,6 +2895,29 @@ ... \&.endif +##### +# A badly formed condition is ignored (after a warning) +# which means *all the lines following will be processed* +# (until a valid condition statement which is False is +# encountered). +##### + +PROCESS = no +SUBPART = no + +# We meant not to process the following but all the +# lines up to the next .if statement *are* processed +# because the bad syntax on the next line means it's ignored + +\&.if PROCESS != no + ... # Processed! + + \&.if [SUBPART] == yes # *Now* we'll stop + ... + \&.endif + +\&.endif + .fi