Escape to shell

When a shell program has been used to start up the editor, and the shell program has taken the appropriate measures necessary to allow the editor to tap into its command capabilities, the editor will detect this. Then the editor will not submit the program itself but pass the combination of progname + command tail as a single string to the shell for further processing. Settings concerningthe cursor are restored as much as possible to what stedi found at startup. After the command has been executed stedi will test its environment and reinitialize it completely if the need arises. It is clear that such an interaction with a shell will greatly enhance the power of the ! statements as full use can be made of the possibilities of the shell (like aliasing, shell scripts, search paths, etc.).

The issuing of external commands that are rather complicated can be made much easier in combination with either the key redefinitions, the learn mode or the macro's. One could for instance make the simple macro:

	save
	set name = $filename ^= "."
	!-cc -o $name.exe -iD:\include -DDEBUG -C $name.c
	!$name.exe

If this macro is called cc (or sits in the file cc.mac) the command

	x cc

will save the contents of the current buffer, create the variable name as the basename of the file without its extension, have the shell call cc with the proper parameters so that the new file is compiled. If the compilation is successful the program is executed. This can give a very quick turnaround during debugging. If output redirection is possible one could have compilation errors caught in a file and have another macro to load this file, read in which line the first error was found and jump to this line. This second macro would depend on how the compiler produces its error messages.

It is also possible to bind the execution of the macro `cc' to a single key like Ctrl-P via the key redefinitions. The whole execution of the program in the current buffer would then be reduced to pressing one key combination!