Index: tclreadlineSetup.tcl.in ================================================================== --- tclreadlineSetup.tcl.in +++ tclreadlineSetup.tcl.in @@ -1,8 +1,8 @@ #!/usr/locanl/bin/tclsh -# FILE: "/home/joze/src/tclreadline/tclreadlineSetup.tcl.in" -# LAST MODIFICATION: "Fri Sep 3 16:16:44 1999 (joze)" +# FILE: "/diska/home/joze/src/tclreadline/tclreadlineSetup.tcl.in" +# LAST MODIFICATION: "Sat Sep 4 07:35:09 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -744,11 +744,11 @@ set mod $part } if {[catch [list set script_result \ [complete(${cmd}) $part \ - $start $end $line $pos $mod]] msg] + $start $end $line $pos $mod]] ::tclreadline::errorMsg] } { error "error during evaluation of `complete(${cmd})'" } return ${script_result} } @@ -790,15 +790,16 @@ namespace eval ::tclreadline { variable prompt_string set base [file tail [info nameofexecutable]] - if {$base == "tclsh" && [info exists tcl_version]} { + if {[string match tclsh* $base] && [info exists tcl_version]} { set prompt_string \ - "\[0;91m$base$tcl_version\[0m" - } elseif {$base == "wish" && [info exists tk_version]} { - set prompt_string "\[0;94m$base$tk_version\[0m" + "\[0;91mtclsh$tcl_version\[0m" + } elseif {[string match wish* $base] \ + && [info exists tk_version]} { + set prompt_string "\[0;94mwish$tk_version\[0m" } else { set prompt_string "\[0;91m$base\[0m" } } @@ -828,12 +829,12 @@ proc exit {args} { if {[catch { ::tclreadline::readline write \ [::tclreadline::HistoryFileGet] - } msg]} { - puts stderr $msg + } ::tclreadline::errorMsg]} { + puts stderr $::tclreadline::errorMsg } if [catch "eval ::tclreadline::Exit $args" message] { puts stderr "error:" puts stderr "$message" @@ -860,13 +861,13 @@ set historyfile $env(HOME)/.tclsh-history } else { set historyfile .tclsh-history } } - set msg [readline initialize $historyfile] - if {$msg != ""} { - puts stderr "$msg" + set ::tclreadline::errorMsg [readline initialize $historyfile] + if {$::tclreadline::errorMsg != ""} { + puts stderr $::tclreadline::errorMsg } InitCmds rename Setup "" @@ -918,12 +919,13 @@ } while {![::tclreadline::readline complete $LINE]} { append LINE "\n" append LINE [tclreadline::readline read ${prompt2}] } - } msg]} { - puts stderr [list tclreadline::Loop: error. $msg] + } ::tclreadline::errorMsg]} { + puts stderr [list tclreadline::Loop: error. \ + $::tclreadline::errorMsg] continue } # Magnus Eriksson proposed history add $LINE @@ -932,12 +934,12 @@ set result [eval $LINE] if {$result != "" && [tclreadline::Print]} { puts $result } set result "" - } msg] { - puts stderr $msg + } ::tclreadline::errorMsg] { + puts stderr $::tclreadline::errorMsg puts stderr [list while evaluating $LINE] } } } @@ -2154,11 +2156,11 @@ # TK # ------------------------------------- # generic widget configuration -proc TrySubCmds cmd { +proc TrySubCmds {cmd} { set trystring ____ set result "" if [catch {set result [${cmd} ${trystring}]} msg] { if {[regexp {bad *option.*____.*: *must *be( .*$)} ${msg} all raw]} { regsub -all -- , ${raw} { } raw @@ -2169,15 +2171,25 @@ if {"or" != ${word} && ${i} != ${len_2}} { lappend result ${word} } } + } else { + # check, if it's a blt error msg ... + # + set msglst [split ${msg} \n] + foreach line ${msglst} { + if {[regexp "${cmd}\[ \t\]\+\(\[^ \t\]*\)\[^:\]*$" \ + ${line} all sub]} { + lappend result [list ${sub}] + } + } } } return ${result} } - + proc WidgetList {pattern} { regsub {^([^\.])} ${pattern} {\.\1} pattern if {[winfo exists ${pattern}]} { return [winfo children ${pattern}] } else {