From f85744142ef599f04704d843af52a70b63c18c88 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Thu, 6 Oct 2016 06:30:22 +1000 Subject: [PATCH] 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 --- initjimsh.tcl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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" -- 2.11.4.GIT