Rmth, version 2.0

A combination of a shell emulator, wish tutorial, and remote interpreter that
uses Elsbeth, based on the rmt demo program in /lib/tk/demos in the Tk
distribution package.

Special Features of Rmth:
	- Takes wish commands or exec commands.
	- Output of exec command can be gradual, just like Elsbeth's I/O pipes
	  either standalone or with addinput.
	- Automatic completion of filenames, variable/array names,
	  Tcl commands and procedures, with optional listbox to display
	  possible endings to ambiguous completions.
	- Automatic expansion of file glob patterns, variable/array values,
	  and Tcl bracketed-command evaluation
	- Automatic history substitution
	- Commands can be automatically executed in a remote Tk interpreter.
	- Quickly learn a Tk procedure or command's arguments.
	- Optional listbox to indicate correct options for a Tk command.
	+ Most of Elsbeth's features!

Rmth understands wish commands, if it does not recognize the command as
legitimate in wish, it assumes the command is a shell command and passes it to
exec. Either way, it prints out the result and any errors generated. (See the
exec(n) manpage for more information on exec.) One can also have graduated
output from an exec command, to do this either append a @ to the command, or
turn on the 'Gradual output' checkbutton off the File menu (which is already on
by default).

Be aware of some of the differences between rmth and a real terminal. Rmth does
not redirect stdout or stderr, so things like puts will still put things out
onto your terminal, not the rmth window. This also means that interactive
commands like patch still take input from the terminal. And, although you can
pass a single command implicitly to exec, you can't pass multiple exec commands
implicitly; you have to specify 'exec cmd1 ; exec cmd2'. Exec also does not
recognize backquotes, so things like `pwd` don't work. And exec also does no
implicit file globbing. (Rmth does expand glob patterns, but only after hitting
Tab, or if the glob is the last word on the command line.)

Rmth adds some menu options to Elsbeth's menus. Under the 'Index menu, it adds
an item, called Application, indicates what interpreter to execute the commands
in. If any but local is selected, than all wish/exec commands are executed in
the remote interpreter. Note that gradual reading is not possible in remote
interpreter execution. The other menu options are analogous to rmth's extra
keybindings, which are described below.

Rmth also supports many types of completion and history substitution. Pressing
Tab in the text window has the same effect as on entries, completion of
filenames, glob patterns, variable names/values, or Tcl commands is performed.
The expansion is performed with respect to whatever interpreter is being sent to
at the time. In addition, rmth supports history substitution, where tabbing on
!<history> returns the event in the history stack (see the history(n) manpage
for details), and !!<Tab> yields the most recent event. Upon hitting <Return>,
rmth does only history expansion and file globbing. Only commands which didn't
yield errors get added to the history stack.

Rmth uses all of the keybindings taught by the Teacher Hypertools to elsbeth,
but it does not use any bindings unique to elsbeth, such as Visit-file. The
Help, Quit, and Gradual-IO commands are analogous to elsbeth's commands, but
they work slightly differently in rmth (for example, Help brings up this file,
instead of elsbeth's help file, pressing <Meta-Control-h> in this file brings up
elsbeth's help file, since elsbeth is the program actually displaying this
file.)

Rmth also lets you do simple browsing and editing of previous commands. One can
traverse between commands with Control-N and Control-P. Control-N puts the
cursor at the beginning of the next command, and Control-P puts the cursor at
the beginning of the previous command (or current one if it is not already
there). One can select the current command with Control-J. And Control-A moves
to the beginning of the current command, while Control-E goes to the end.

				Control-
				   P
Command:	Traversal:	 A + E
				   N
		Select:		   J

Several editing functions are also added. Control-D deletes from the cursor to
the end of the command, and Control-H deletes from cursor to beginning of the
command. Neither can be yanked, but both are undoable. Finally, Control-U kills
the current command, it can be yanked, though not undone.

				Control-
Command:	Delete:		 H + D
		Kill:		   U

Finally, rmth adds one last unique binding. The Control-u command clears the
text from the insert cursor to the beginning. Clear: 				Control-u

Upon startup, rmth sources the rmth in the $HOME/.th directory, and the .rmth
file in the current directory, if they exist. Via Elsbeth, it also sources
elsbeth in $HOME/.th and [pwd]/.elsbeth. 

If a wish or exec command generates an error, the error is printed and the
command is brought back up after the new prompt, so you can re-execute it after
correcting the command. However, certain errors are handled specially by rmth.
There is an info label under the rmth text window. It is normally hidden, but it
gets brought up under certain cases when a message doesn't really belong in the
rmth text window, but should be made known to the user. If a command generates
an error in the info label, nothing gets added to the text, and so you can edit
the same command line to fix the command.

If rmth has trouble sending a command to a remote interpreter, then the error is
brought up in a dialog box, as usual, but rmth also automatically switches back
to the local interpreter.

Sometimes a command passed to exec terminates normally, while still reporting an
error, and sometimes the error causes the command to terminate abnormally. In
this case, exec usually sends an error of its own, however this error is not put
in the rmth window, it is merely brought up on the info label. The error from
the shell command does, however, get put in the rmth window.

It is an error to indicate gradual reading in a remote interpreter. If you
merely leave the 'Gradual output' option on in a remote interpreter, it will be
ignored. However, if you explicitly imply gradual output by appending your
command with a @ in a remote interpreter, an error will appear on the info
line.

If you press Tab after entering a wish procedure, the arguments of the procedure
get displayed on the info label.

If you enter the wrong number of arguments in a wish command, or you give a bad
option to a wish command, an appropriate Tk error message is brought up on the
info label.

If the Tk error message to a wish command contains possible correction values,
the values are brought up in a listbox. You can either click 'OK' and fix the
command manually, or select an item in the listbox, and rmth will correct the
command for you. (This is the same listbox widget that gets brought up by
Control-Tab in elsbeth.)

These error routines make rmth very useful as a wish command interpreter. Using
command completion, you can get the full name of any incomplete wish command or
procedure by pressing Tab on an incomplete command/procedure. With a complete
procedure, pressing Tab returns you a list of the procedure's arguments.
Pressing Return with the wrong number of arguments tells you the correct number
of arguments for a command or procedure. Also pressing Return with an incorrect
option or command argument will often get you a list of the possible correct
values to use. And finally, you can complete Tk variables and arrays, or
evaluate Tk bracketed expressions, or see a complete variable's value by
pressing Tab.


Maintainer

David Svoboda
svoboda@ece.cmu.edu


Bugs / Limitations

The vertical grid is diabled. This is because the vertical grid widget is used
to hold the prompts.

It is possible to screw up the tag bindings if you alter the text above the last
command (which was the only thing the old rmth let you edit). Generally, you
should not alter the text above the last command line.


