View · Search · Index
No registered users in community xowiki
in last 10 minutes

RE: [Xotcl] Request for XOTcl proc and var type ahead in tkcon

From: Jeff Hobbs <>
Date: Wed, 6 Apr 2005 22:32:19 -0700

Oh yeah ... tkcon seems to be certainly well enough architectured
(in this case ;) ) to handle this easily. Add this to tkcon:

proc ::tkcon::ExpandXotcl str {
    # in a first step, get the cmd to check, if we should handle subcommands
    set cmd [::tkcon::CmdGet $::tkcon::PRIV(console)]
    # Only do the xotcl magic if there are two cmds and xotcl is loaded
    if {[llength $cmd] != 2
        || ![EvalAttached [list info exists ::xotcl::version]]} {
    set obj [lindex $cmd 0]
    set sub [lindex $cmd 1]
    set match [EvalAttached [list $obj info methods $sub*]]
    if {[llength $match] > 1} {
        regsub -all {([^\\]) } [ExpandBestMatch $match $str] {\1\\ } str
        set match [linsert $match 0 $str]
    } else {
        regsub -all {([^\\]) } $match {\1\\ } match
    return $match

and then do this:

tkcon master set ::tkcon::OPT(expandorder) \
   {Xotcl Variable Procname Pathname}

Note that this puts pathname at the end, also addressing Gustaf's
request that it's too picky. You have to have Xotcl before
Procname for it to be really useful.

I've added the above proc to the tkcon sources, but I didn't change
the expandorder to include it yet ... I suspect it's "fast enough",
but if somebody with a slow machine could confirm, that would be

  Jeff Hobbs, The Tcl Guy, a division of Sophos