No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Request for XOTcl proc and var type ahead in tkcon
From: John McGlaughlin <jmcglaug_at_cisco.com>
Date: Thu, 07 Apr 2005 09:10:45 -0400
Thanks all,
Very helpful
Lazy John
Jeff Hobbs wrote:
>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]]} {
> return
> }
> 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
>nice.
>
> Jeff Hobbs, The Tcl Guy
> http://www.ActiveState.com/, a division of Sophos
>
>
>
Date: Thu, 07 Apr 2005 09:10:45 -0400
Thanks all,
Very helpful
Lazy John
Jeff Hobbs wrote:
>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]]} {
> return
> }
> 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
>nice.
>
> Jeff Hobbs, The Tcl Guy
> http://www.ActiveState.com/, a division of Sophos
>
>
>