The jprefixmatch.tcl library is distributed as part of the jstools package. It contains procedures to do prefix expansion like that done for filename completion by tcsh(1) and Emacs, or for command disambiguation under VMS.
This document describes jprefixmatch.tcl version 3.6/3.0.
Usage
Accessing the Library
In order to use the jprefixmatch.tcl library, it (and any other libraries it depends on) must be in your Tcl auto_path, described in tclvars(n). Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.
Credits and Copyright
Author
Jay Sekora
js@bu.edu
http://shore.net/~js/
Copyright
The library is copyright ⌐ 1992-1994 by Jay Sekora, but may be freely copied and modified for non¡commercial purposes. (Please contact me if you want to use it for a commercial purpose, this may be OK under some circumstances.)
Overview
Procedures
j:longest_match - find the longest common initial string in a list
j:expand_filename - expand filename prefix as much as possible
j:longest_match
Usage
j:longest_match l
Argument
l - list of strings
Description
This procedure finds and returns the longest common initial string in list l. If there's no common initial string, it returs the empty list {}. It's used by j:expand_filename for filename completion, but could also be used for things like handling abbreviations.
j:expand_filename
Usage
j:expand_filename f
Argument
f - initial filename prefix to be expanded
Description
This procedure tries to do filename completion on the prefix f, as in Emacs and tcsh. It returns the longest initial substring common to those filenames in the current directory that match f. It also can be used for globbing; if f contains globbing metacharacters (`*', `?', or `[...]'), they will be expanded as in the shell.
Evolution
Feel free to report bugs (and feature requests) to me, <js@bu.edu>, and I will try to deal with them. Also, feel free to fix bugs or add features on your own and let me know how you did it.
Bugs and Limitations
* The expansion of globbing metacharacters, while occasionally useful, is unlikely to be intuitive to a user. (You might want to check for these in your code before calling j:expand_filename.)
Changes
* These procedures used to be in a file called jlibrary.tcl. Starting with version 3.6/2.0, they're in their own independent library.