tkcon(1) General Commands Manual tkcon(1)
______________________________________________________________________________
NAME
tkcon - Tk console replacement
SYNOPSIS
tkcon [{option value | tcl_script} ...]
______________________________________________________________________________
DESCRIPTION
TkCon is a replacement for the standard console that comes with Tk (on
Windows/Mac, but also works on Unix). The console itself provides many
more features than the standard console. TkCon works on all platforms
where Tcl/Tk is available. It is meant primarily to aid one when work-
ing with the little details inside Tcl and Tk, giving Unix users the
GUI console provided by default in the Mac and Windows Tk.
tkcon [{option value | tcl_script} ...]
OPTIONS
Except for -rcfile, command line arguments are handled after the TkCon
resource file is sourced, but before the slave interpreter or the TkCon
user interface is initialized.
-rcfile is handled right before it would be sourced, allowing you to
specify any alternate file. Command line arguments are passed to each
new console and will be evaluated by each. To prevent this from hap-
pening, you have to say
tkcon main set argv {}; tkcon main set argc 0
For these options, any unique substring is allowed.
-argv (also --)
Causes TkCon to stop evaluating arguments and set the remaining
args to be argv/argc (with -- prepended). This carries over for
any further consoles. This is meant only for wrapping TkCon
around programs that require their own arguments.
-color-<color> color
Sets the requested color type to the specified color for tkcon.
See tkconrc(5) for the recognized <color> names.
-eval tcl_script (also -main or -e)
A Tcl script to eval in each main interpreter. This is evalu-
ated after the resource file is loaded and the slave interpreter
is created. Multiple -eval switches will be recognized (in or-
der).
-exec slavename
Sets the named slave that tkcon operates in. In general, this
is only useful to set to "" (empty), indicating to tkcon to
avoid the multi-interpreter model and operate in the main envi-
ronment. When this is empty, any further arguments will be only
used in the first tkcon console and not passed onto further new
consoles. This is useful when using tkcon as a console for ex-
tended wish executables that don't load there commands into
slave interpreters.
-font font
Sets the font that tkcon uses for its text windows. If this
isn't a fixed width font, tkcon will override it.
-nontcl TCL_BOOLEAN
Sets ::tkcon::OPT(nontcl) to TCL_BOOLEAN (see tkconrc(5)).
Needed when attaching to non-Tcl interpreters.
-package package_name (also -load)
Packages to automatically load into the slave interpreters (i.e.
"Tk").
-rcfile filename
Specify an alternate tkcon resource file name.
-root widgetname
Makes the named widget the root name of all consoles (i.e. .tk-
con).
-slave tcl_script
A Tcl script to eval in each slave interpreter. This will ap-
pend the one specified in the tkcon resource file, if any.
KEY BINDINGS
Most of the bindings are the same as for the text widget. Some have
been modified to make sure that the integrity of the console is main-
tained. Others have been added to enhance the usefulness of the con-
sole. Only the modified or new bindings are listed here.
Control-x or Cut (on Sparc5 keyboards)
Cut.
Control-c or Copy (on Sparc5 keyboards)
Copy.
Control-v or Paste (on Sparc5 keyboards)
Paste.
Insert Insert (duh).
Up Goes up one level in the commands line history when cursor is on
the prompt line, otherwise it moves through the buffer.
Down Goes down one level in the commands line history when cursor is
on the last line of the buffer, otherwise it moves through the
buffer.
Control-p
Goes up one level in the commands line history.
Control-n
Goes down one level in the commands line history.
Tab Tries to expand file path names, then variable names, then proc
names.
Escape Tries to expand file path names.
Control-P
Tries to expand procedure names. The procedure names will be
those that are actually in the attached interpreter (unless
nontcl is specified, in which case it always does the lookup in
the default slave interpreter).
Control-V
Tries to expand variable names (those returned by [info vars]).
It's search behavior is like that for procedure names.
Return or Enter
Evaluates the current command line if it is a complete command,
otherwise it just goes to a new line.
Control-a
Go to the beginning of the current command line.
Control-l
Clear the entire console buffer.
Control-r
Searches backwards in the history for any command that contains
the string in the current command line. Repeatable to search
farther back. The matching substring off the found command will
blink.
Control-s
As above, but searches forward (only useful if you searched too
far back).
Control-t
Transposes characters.
Control-u
Clears the current command line.
Control-z
Saves current command line in a buffer that can be retrieved
with another Control-z. If the current command line is empty,
then any saved command is retrieved without being overwritten,
otherwise the current contents get swapped with what's in the
saved command buffer.
Control-Key-1
Attaches console to the console's slave interpreter.
Control-Key-2
Attaches console to the console's master interpreter.
Control-Key-3
Attaches console to main TkCon interpreter.
Control-A
Pops up the "About" dialog.
Control-N
Creates a new console. Each console has separate state, includ-
ing it's own widget hierarchy (it's a slave interpreter).
Control-q
Close the current console OR Quit the program (depends on the
value of ::tkcon::TKCON(slaveexit)).
Control-w
Closes the current console. Closing the main console will exit
the program (something has to control all the slaves...).
TkCon also has electric bracing (similar to that in emacs). It will
highlight matching pairs of {}'s, []'s, ()'s and ""'s. For the first
three, if there is no matching left element for the right, then it
blinks the entire current command line. For the double quote, if there
is no proper match then it just blinks the current double quote charac-
ter. It does properly recognize most escaping (except escaped es-
capes), but does not look for commenting (why would you interactively
put comments in?).
COMMANDS
There are several new procedures introduced in TkCon to improve produc-
tivity and/or account for lost functionality in the Tcl environment
that users are used to in native environments. There are also some re-
defined procedures. Here is a non-comprehensive list:
alias ?sourceCmd targetCmd ?arg arg ...??
Simple alias mechanism. It will overwrite existing commands.
When called without args, it returns current aliases. Note that
TkCon makes some aliases for you (in slaves). Don't delete
those.
clear ?percentage?
Clears the text widget. Same as the <Control-l> binding, except
this will accept a percentage of the buffer to clear (1-100, 100
default).
dir ?-all? ?-full? ?-long? ?pattern pattern ...?
Cheap way to get directory listings. Uses glob style pattern
matching.
dump type ?-nocomplain? ?-filter pattern? ?--? pattern ?pattern ...?
The dump command provides a way for the user to spit out state
information about the interpreter in a Tcl readable (and human
readable) form. See dump(3tk) for details.
echo ?arg arg ...?
Concatenates the args and spits the result to the console (std-
out).
edit ?-type type? ?-find str? ?-attach interp? arg
Opens an editor with the data from arg. The optional type argu-
ment can be one of: proc, var or file. For proc or var, the arg
may be a pattern.
idebug command ?args?
Interactive debugging command. See idebug(3tk) for details.
lremove ?-all? ?-regexp -glob? list items
Removes one or more items from a list and returns the new list.
If -all is specified, it removes all instances of each item in
the list. If -regexp or -glob is specified, it interprets each
item in the items list as a regexp or glob pattern to match
against.
less Aliased to edit.
ls Aliased to dir -full.
more Aliased to edit.
observe type ?args?
This command provides passive runtime debugging output for vari-
ables and commands. See observe(3tk) for details.
puts (same options as always)
Redefined to put the output into TkCon.
tkcon method ?args?
Multi-purpose command. See tkcon(3tk) for details.
tclindex ?-extensions patternlist? ?-index TCL_BOOLEAN? ?-package
TCL_BOOLEAN? ?dir1 dir2 ...?
Convenience proc to update the "tclIndex" (controlled by -index
switch) and/or "pkgIndex.tcl" (controlled by -package switch)
file in the named directories based on the given pattern for
files. It defaults to creating the "tclIndex" but not the
"pkgIndex.tcl" file, with the directory defaulting to [pwd].
The extension defaults to *.tcl, with *.[info sharelibextension]
added when -package is true.
unalias cmd
unaliases command.
what string
The what command will identify the word given in string in the
Tcl environment and return a list of types that it was recog-
nized as. Possible types are: alias, procedure, command, array
variable, scalar variable, directory, file, widget, and exe-
cutable. Used by procedures dump and which.
which command
Like the which command of Unix shells, this will tell you if a
particular command is known, and if so, whether it is internal
or external to the interpreter. If it is an internal command
and there is a slot in auto_index for it, it tells you the file
that auto_index would load. This does not necessarily mean that
that is where the file came from, but if it were not in the in-
terpreter previously, then that is where the command was found.
There are several procedures that I use as helpers that some may find
helpful in there coding (i.e. expanding pathnames). Feel free to lift
them from the code (but do assign proper attribution).
EXAMLPES
Some examples of tkcon command line startup situations:
megawish /usr/bin/tkcon -exec "" -root .tkcon mainfile.tcl
Use tkcon as a console for your megawish application. You can avoid
starting the line with megawish if that is the default wish that TkCon
would use. The -root ensures that tkcon will not conflict with the ap-
plication root window.
tkcon -font "Courier 12" -load Tk
Use the courier font for TkCon and always load Tk in slave interpreters
at startup.
tkcon -rcfile ~/.wishrc -color-bg white
Use the ~/.wishrc file as the resource file, and a white background for
TkCon's text widgets.
FILES
TkCon will search for a resource file in "~/.tkconrc". TkCon never
sources the "~/.wishrc" file. The resource file is sourced by each new
instance of the console. An example resource file is provided in tk-
conrc(5).
SEE ALSO
dump(3tk), idebug(3tk), observe(3tk), text(3tk), tkcon(3tk), tkconrc(5)
KEYWORDS
Tk, console
COPYRIGHT
Copyright (c) Jeffrey Hobbs (jeff at hobbs.org)
TkCon 2.5 tkcon(1)