diff --git a/twander.1 b/twander.1 index 7a3fbeb..86f2e02 100644 --- a/twander.1 +++ b/twander.1 @@ -3607,7 +3607,7 @@ double-click on a file and the interface can infer which program to load to process that file. -The problem is that the various window manager and Microsoft Windows don't +The problem is that the various window managers and Microsoft Windows don't all handle associations the same way. Some lighter X-Windows window managers may not even have associations at all. In order for to remain portable across operating systems, and work more-or-less the same way @@ -3616,8 +3616,8 @@ All you have to do is tell \fCtwander\fP which program to use for a given file "type". A "type" is defined as a group of files whose -names end with the same string of characters. You do this -by adding association statement to the Configuration File: +names match a so-called "wildcard" (more on that in a moment). You do +this by adding association statement to the Configuration File: .ft C \" courier .nf @@ -3625,7 +3625,7 @@ # Associations are in the form: # ASSOC file-type-string command-to-handle-this-type-of-file - ASSOC .txt emacs [SELECTION] + ASSOC *.txt emacs [SELECTION] .fi .ft \" revert @@ -3646,7 +3646,7 @@ EDITOR = emacs -fn 10x20 - ASSOC .txt {YESNO:Are You Sure You Want To Edit This File?} [EDITOR] [SELECTION] + ASSOC *.txt {YESNO:Are You Sure You Want To Edit This File?} [EDITOR] [SELECTION] .fi .ft \" revert @@ -3655,9 +3655,9 @@ .ft C \" courier .nf - ASSOC .pdf mypdfreader [SELECTION] - ASSOC .ps mypostscriptprogram [SELECTION] - ASSOC * myfineeditor [SELECTION] + ASSOC *.pdf mypdfreader [SELECTION] + ASSOC *.ps mypostscriptprogram [SELECTION] + ASSOC * myfineeditor [SELECTION] .fi .ft \" revert @@ -3678,7 +3678,7 @@ .ft C \" courier .nf - ASSOC - space-separated-list-of-file-types + ASSOC ! space-separated-list-of-file-types .fi .ft \" revert @@ -3688,7 +3688,7 @@ .ft C \" courier .nf ASSOC * myfineeditor [SELECTION] - ASSOC - .txt .pyo .ps + ASSOC ! *.txt *.pyo *.ps .fi .ft \" revert @@ -3697,15 +3697,15 @@ .B except files whose names end with \fC.txt\fP, \fC.pyo\fP, or .\fCps\fP. These excluded file types would be handed to the underlying OS -for "execution". +for processing when they are selected. Note that exclusion has higher precedence than any explicit association, not just the default association. If you do this: .ft C \" courier .nf - ASSOC .pdf mypdfreader [SELECTION] - ASSOC - .pdf + ASSOC *.pdf mypdfreader [SELECTION] + ASSOC ! .pdf .fi .ft \" revert @@ -3720,8 +3720,16 @@ # This example first defines, and then removes an association # for .pdf files: - ASSOC .pdf mypdfreader [SELECTION] - ASSOC .pdf + ASSOC *.pdf mypdfreader [SELECTION] + ASSOC *.pdf + + # This one removes any exclusions you might have previously defined + + ASSOC ! + + # This one removes any default association you might have previously defined + + ASSOC * .fi .ft \" revert @@ -3735,6 +3743,73 @@ ). +.SS Association Wildcards + +Associations are built around the idea of a file "type". You want files +of the same type handled by the same application program. On Windows +systems, this has traditionally been the set of characters the follow +the period at the end of the filename. But this convention is not +consistently used on Unix-like systems. \fCtwander\fP lets you use a +fairly powerful "widcarding" system to define what is common about the +names of all files of a given type. Unix users will recognize this as +the shell \fCglobbing\fP wildcards. Here they are implemented for +both Windows and the Unix-like systems in the same way. The only +difference is that, on Windows, the check for a match ("is this file +of type ...?") is done without regard to case, whereas on the +Unix-like systems, case matters. + +If you are unfamiliar with Unix-style shell globbing, many references +can easily be found on the web. Here is a summary of the "meta" +characters supported: + +.ft C \" courier +.nf + + * Matches everything - strings of any length with any characters + + Example: *.text matches all filenames ending in ".text" + + ? Matches a single character + + Example: foo.??? matches all filenames beginning with "foo." + and ending with any three characters. + + [list] Matches any characters in the list + + Example: foo*[t,T] matches all filenames beginning with "foo", + with any number of characters following, and + ending with either the letters "t" or "T". + + [!list] Matches any character NOT in the list + + Example: foo*[!t,T] matches all filenames beginning with "foo", + with any number of characters following, and NOT + ending with either the letters "t" or "T". + + Lists can also be ranges. For example: + + [a-z] Matches any lowercase letter + [A-Z] Matches any uppercase letter + [0-9] Matches any numeric digit +.fi +.ft \" revert + +So, why bother with this? Because sometimes you want associate an action +with a set of files whose names are similar but vary in some known way. +For instance, suppose you have a database program that produces files +named "data01, data02, data03, ..." and so on. Instead of having to +write a separate association for each different possible filename, you +can just do this: + +.ft C \" courier +.nf + + ASSOC data?? MyFineDatabaseProgram [SELECTION] +.fi +.ft \" revert + + + .SS A Few Association Subtleties @@ -3750,8 +3825,8 @@ .ft C \" courier .nf - ASSOC .text emacs [SELECTION] - ASSOC xt ci [SELECTION] + ASSOC *.text emacs [SELECTION] + ASSOC *xt ci [SELECTION] .fi .ft \" revert @@ -3761,7 +3836,10 @@ no way to tell - it's a nonsense condition when a given file type matches more than one association. The moral of the story here is to make sure each of your \fCASSOC\fP statements associates a completely -unique file type. +unique file type. Be really careful about this when using complex +wildcards to specify the file "type". It's easy for wildcards to +overlap in their definition of a filename and you'll end up with +more than a single, unique association for a given type of file. .IP \(bu 4 The "default" association - if defined - will only be applied if no @@ -3779,29 +3857,12 @@ you double-click on it. .IP \(bu 4 -Note that there is no wildcarding in the type definition. This -will not do what you might think: - -.ft C \" courier -.nf - ASSOC t*xt emacs [SELECTION] -.fi -.ft \" revert - -This will cause \fCtwander\fP to match only on filenames that literally -end with "t*xt", whereas you probably meant "match any filename starting with -t and ending with xt". In short, you cannot use regular expressions -in association type fields. The one exception is the default association, -where * is understood to mean "match any file whose type is not otherwise -handled by another association statement". - -.IP \(bu 4 Be careful which Built In Variables you use in an association handler definition. Suppose you do this: .ft C \" courier .nf - ASSOC .txt emacs [SELECTIONS] + ASSOC *.txt emacs [SELECTIONS] .fi .ft \" revert @@ -3825,7 +3886,7 @@ .ft C \" courier .nf - ASSOC .py python [SELECTIONS] + ASSOC *.py python [SELECTIONS] .fi .ft \" revert @@ -3850,7 +3911,11 @@ format. -.SS More About Associations On Microsoft Windows +.SS Associations Differences Across Platforms + +For the most part, \fCtwander\fP associations work pretty much the +same way on all systems . There are, however, some slight differences +between the Unix-like systems and Windows. .IP \(bu 4 On Unix-like operating systems \fCtwander\fP ignores the underlying @@ -3891,7 +3956,9 @@ As noted in the previous section, matching the file "type" is case-sensitive on Unix-like systems and case-insensitive under Windows. This is because, although Windows observes case in -file names, they are not signficant. +file names, they are not signficant. Similarly, file types +listed in the association exclusion list are treated in a +case-insensitive way on Windows systems. .IP \(bu 4 On Unix-like systems, if you attempt double-click or press Enter @@ -5135,4 +5202,4 @@ .ft \" revert .SH DOCUMENT REVISION INFORMATION -$Id: twander.1,v 1.140 2006/12/19 00:22:59 tundra Exp $ \ No newline at end of file +$Id: twander.1,v 1.141 2006/12/19 10:05:16 tundra Exp $ \ No newline at end of file