Updated 2017-01-28 01:28:03 by SEH
What: eltclsh
Where: http://freshmeat.net/projects/eltclsh/ (out of date, refers to v1.5)
Description: editline tcl shell is an interactive shell for the Tcl language. It provides command line editing, history browsing, and variable/command completion, thanks to editline features. The completion engine is programmable, and comes with built in completion for all of Tk. The package also includes elwish, an interactive interpreter for Tcl/Tk.
Currently at version 1.14.
Updated: 12/2012
Contact: See web site

Summary  edit

aspect: The eltclsh distribution packages eltclsh as an extension, which the binary simply package requires into the interpreter it creates. The extension includes a signal handler and the editline binding itself.

build  edit

on FreeBSD: need gmake, and to touch eltclsh.1.cat in the unpacked eltclsh-1.9 directory; before running
./configure --with-tk=no;gmake install clean

Build for a Tcl/Tk8.5 system:

  • eltclsh has proved to operate correctly.
  • elwish did not show up the initial Tk window (eltclsh with package require Tk does).

Upon a sample build session of eltcsh with editline a link error (missing lXss) has been encountered (on a debian-based machine). This could be resolved by installing libxss-dev.

Use  edit

To get eltclsh as the completion engine for your standard tclsh in interactive mode (similar to how it is done on tclreadline), simply add something like the following to your [.tclshrc]:
if {![file exists /usr/local/share/eltcl/pkgIndex.tcl] || [catch {
    lappend ::auto_path /usr/local/share/eltcl
    package require eltclsh
    set ::el::prompt1 {list tclsh [info patchlevel] %}
    set ::el::prompt2 {list tclsh ...... >}
}]} {
    puts "Failed to load eltclsh!"

.. at this point you could try to fall back on tclreadline, or the standard tclsh prompt (which is default behaviour with the above code). The "interactive" command is eltclsh's equivalent of "::tclreadline::Loop". Loading eltclsh in this manner has at least a few advantages: you don't have to retrain your fingers from typing "tclsh", and the same mechanism can work against multiple tclsh versions, without having to link multiple "eltclsh" binaries.

The eltclsh code is quite tidy and straightforward. Noteworthy is tools/complete.tcl, which sets up a variable ::el::completionPatterns which it uses to do argument completion of core Tcl commands.