--- ../console.tcl 2016-06-04 18:38:00.296278200 +0200 +++ tk/library/console.tcl 2016-06-04 21:08:25.751885200 +0200 @@ -44,7 +44,7 @@ if {![consoleinterp eval {set tcl_interactive}]} { wm withdraw . } - + consoleinterp eval {set ::L 0} if {[tk windowingsystem] eq "aqua"} { set mod "Cmd" } else { @@ -247,6 +247,18 @@ } elseif {[info complete $cmd]} { .console mark set output end .console tag delete input + + # Check for #lang comments and replace them for meaningful commands + set isL [consoleinterp eval {set ::L}] + if {!$isL && [string equal -nocase -length 7 "#lang l" $cmd]} { + set cmd "set ::L 1\n" + } elseif {$isL && [string equal -nocase -length 9 "#lang tcl" $cmd]} { + set cmd "set('::L',0);\n" + } + if {$isL} { + set cmd "L [list $cmd]" + } + set result [consoleinterp record $cmd] if {$result ne ""} { puts $result