Rmth, version 2.1

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.
	- Still responds to Elsbeth commands while doing an exec command.
	- 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) and open(n) manpages.)

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. If you want a glob pattern expanded, (such as in 'ls *.c'), leave the cursor immediately after the glob pattern, and rmth will expand it before passing it to exec.

Rmth adds some menu options to Elsbeth's menus. It adds an application menu on
the right, full of interpreter names. You can select one to shunt all future
commands to that interpreter. Or you can select 'local' to have rmth execute
all commands itself. You can pop up this application menu by pressing Button 3
in the text widget, too.

Rmth also supports many types of completion and history substitution. Pressing Escape 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 !!<Escape> 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. Finally, if you press Escape after entering the complete name of a Tcl procedure, the arguments of the procedure get displayed below the window.

Rmth uses all of the keybindings taught by the Teacher Hypertools to elsbeth, The Help command differs from elsbeth's Help command by bringing up this file instead of Elsbeth's help file. The Quit and Long-lines commands work like Elsbeth's.

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 Meta-a moves to
the beginning of the current command, while Meta-e goes to the end. Control-u
kills the current command. Finally, you can delete all the text up to the line
containing the cursor using Meta-L.

				   Control-P
Command:	Traversal:	 Meta-a + Meta-e
				   Control-N
		Select:		   Control-j
		Kill: 		   Control-u
Delete: 	To Line: 	   Meta-L

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. 

Rmth also handles some errors in special manners. Most errors simply get printed out to rmth's window, like they would in a real terminal. A few, however, get shown in a label under the window, and the cursor does not go to a new line, thereby letting you edit the same command to make it 'right'. Some Tk error messages that list the correct possibilities get displayed in listboxes, so you can select the correct word to replace the incorrect one. (An example error message would be: "bad tag option 'foo', must be add, bind, cget...") If a remote interpreter dies before finishing a command, or is already dead when that command is executed, the application menu automatically switches back to local.

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 Escape on an incomplete command/procedure. With a complete procedure, pressing Escape 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 Escape.


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. They line up with the commands properly because the text
widget has no wrapping enabled. If you de-select 'Long Lines' off the Extras
menu, wrapping will be enabled. This will remove the horizontal scrolling, but
the prompts will not be aligned to the commands properly.

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.

A command that is a legal wish and exec command can cause confusion. Rmth tries
to interpret it as follows: If the command is currently a valid wish command
(it does not require auto-loading), it is interpreted as such. Otherwise, if it
is a valid exec command (it exists in the user's $PATH), it is interpreted as
such. Otherwise, Tcl's unknown procedure is invoked on the command, which
handles auto-loading commands.
