aboutsummaryrefslogtreecommitdiff
path: root/initjimsh.tcl
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2016-10-06 06:30:22 +1000
committerSteve Bennett <steveb@workware.net.au>2016-10-06 06:30:22 +1000
commitf85744142ef599f04704d843af52a70b63c18c88 (patch)
treef9acae21cf31d197e279559238849d2eca484d9e /initjimsh.tcl
parentc760be2a2c29ba8ce0848bd894af58a74eb0f14a (diff)
downloadjimtcl-f85744142ef599f04704d843af52a70b63c18c88.zip
jimtcl-f85744142ef599f04704d843af52a70b63c18c88.tar.gz
jimtcl-f85744142ef599f04704d843af52a70b63c18c88.tar.bz2
autocomplete: add global $tcl::autocomplete_commands
Contains commands that suport -commands, to make it easy to add custom commands without replacing the default tcl::autcomplete (although that is still the recommended approach) Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'initjimsh.tcl')
-rw-r--r--initjimsh.tcl5
1 files changed, 4 insertions, 1 deletions
diff --git a/initjimsh.tcl b/initjimsh.tcl
index e6e015e..e0bb011 100644
--- a/initjimsh.tcl
+++ b/initjimsh.tcl
@@ -43,12 +43,15 @@ if {$tcl_platform(platform) eq "windows"} {
set jim::argv0 [string map {\\ /} $jim::argv0]
}
+# Set a global variable here so that custom commands can be added post hoc
+set tcl::autocomplete_commands {info tcl::prefix socket namespace array clock file package string dict signal history}
+
# Simple interactive command line completion callback
# Explicitly knows about some commands that support "-commands"
proc tcl::autocomplete {prefix} {
if {[string match "* " $prefix]} {
set cmd [string range $prefix 0 end-1]
- if {$cmd in {info tcl::prefix socket namespace array clock file package string dict signal history} || [info channel $cmd] ne ""} {
+ if {$cmd in $::tcl::autocomplete_commands || [info channel $cmd] ne ""} {
# Add any results from -commands
return [lmap p [$cmd -commands] {
function "$cmd $p"