{jprefixmatch.tcl
Introduction
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 2001.02.10.
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@aq.org
http://www.aq.org/~js/
Copyright
The library is copyright © 1992-2001 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.
Overview
Procedures
::jstools::longest_match - find the longest common initial string in a list
::jstools::expand_filename - expand filename prefix as much as possible
::jstools::longest_match
Usage
	::jstools::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 ::jstools::expand_filename for filename completion, but could also be used for things like handling abbreviations.
::jstools::expand_filename
Usage
	::jstools::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 (`*', `?', initial `~', or `[...]'), they will be expanded as in the shell.
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 ::jstools::expand_filename.)} {{{list:level:1 {35.0 36.0}} {jhtml:anchor:anchorname {20.0 21.0 27.0 28.0}} {jdoc:anchor:anchorname {2.0 3.0 6.0 7.0 9.0 10.0 16.0 17.0 20.0 21.0 27.0 28.0}} {jdoc:xref:link {3.59 3.66 8.217 8.238 8.246 8.263 8.267 8.288 18.0 18.24 19.0 19.26 26.159 26.185}} {jdoc:xref:manpage {3.165 3.169 3.177 3.182 8.133 8.140 33.70 33.75 33.80 33.84}} {richtext:font:roman {3.0 3.4 3.20 3.59 3.66 3.165 3.169 5.24 5.40 6.0 8.0 8.20 8.36 8.109 8.118 8.133 8.140 8.221 8.228 8.250 8.255 8.267 8.288 9.0 11.0 12.0 12.9 13.0 13.22 14.0 15.0 16.0 18.24 19.0 19.26 20.0 22.27 23.0 24.0 24.1 24.2 25.0 26.0 26.75 26.76 26.141 26.143 26.159 26.185 27.0 29.29 30.0 31.0 31.1 31.2 32.0 33.0 33.61 33.62 33.80 33.84 33.190 33.191 33.231 33.232 33.268 33.269 33.273 33.274 33.286 33.287 33.294 33.295 33.298 33.299 34.0 35.0 35.174 35.200 35.202}} {richtext:font:italic {22.26 22.27 24.1 24.2 26.75 26.76 29.28 29.29 31.1 31.2 33.61 33.62 33.190 33.191 33.231 33.232}} {richtext:font:bold {3.4 3.20 3.59 3.66 5.24 5.40 8.20 8.36 8.221 8.228}} {richtext:font:bolditalic {8.250 8.255 8.267 8.288}} {richtext:font:typewriter {3.165 3.169 8.109 8.118 8.133 8.140 12.0 12.9 13.0 13.22 18.0 18.24 19.0 19.26 22.0 22.26 26.141 26.143 26.159 26.185 29.0 29.28 33.80 33.84 33.268 33.269 33.273 33.274 33.286 33.287 33.294 33.295 33.298 33.299 35.174 35.200}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {2.0 3.0 6.0 7.0 9.0 10.0 16.0 17.0 20.0 21.0 27.0 28.0 34.0 35.0}} {richtext:font:heading2 {7.0 8.0 10.0 11.0 14.0 15.0 17.0 18.0 21.0 22.0 23.0 24.0 25.0 26.0 28.0 29.0 30.0 31.0 32.0 33.0}} {jdoc:anchorname:Introduction {2.0 3.0}} {jdoc:link:jstools.jdoc {3.59 3.66}} {jdoc:anchorname:Usage {6.0 7.0}} {jdoc:manpage:tclvars {8.133 8.140}} {jdoc:link:jslibraries.tcl {8.217 8.238}} {jdoc:link:jslibraries.jdoc#Usage {8.246 8.263}} {jdoc:link:jslibraries.jdoc {8.267 8.288}} {{} {9.0 15.0 17.0 17.10}} {jdoc:anchorname:Credits_and_Copyright {9.0 10.0}} {jdoc:anchorname:Overview {16.0 17.0}} {jdoc:manpage:tcsh {3.165 3.169 33.80 33.84}} {jdoc:manpage:emacs {3.177 3.182 33.70 33.75}} {jdoc:anchorname:j:longest_match {20.0 21.0}} {jdoc:anchorname:j:expand_filename {27.0 28.0}} {list:1:ul {35.0 36.0}} {jhtml:anchorname:::jstools::expand_filename {27.0 28.0}} {jhtml:anchorname:::jstools::longest_match {20.0 21.0}} {jdoc:link:#::jstools::expand_filename {19.0 19.26 26.159 26.185}} {jdoc:link:#::jstools::longest_match {18.0 18.24}} {special:list_item:1 {35.0 35.1}}} {{abbrevstart 33.284} {matchend 5.36} {abbrevend 33.284} {insert 5.59} {insert_save 35.2} {anchor 5.60} {matchstart 5.24} {current 16.0}}} {{body_alink #ff0000} {body_vlink #000080} {body_link #0000ff} {body_text #000000} {body_bgcolor #ffffff}}