Lugaru's Epsilon Programmer's Editor 14.00
Context:
|
Epsilon User's Manual and Reference > Commands by Topic > Running Other Programs > The Concurrent ProcessEpsilon can also run a program in a special way that allows you to interact with the program in a buffer and continue editing while the program runs. It can help in preparing command lines, by letting you edit things you previously typed, and it automatically saves what each program types, so you can examine it later. If a program takes a long time to produce a result, you can continue to edit files while it works. We call a program run in this way a concurrent process.The start-process command, bound to Ctrl-x Ctrl-m, begins a concurrent process. Without a numeric argument, it starts a shell command processor which will run until you exit it (by going to the end of the buffer and typing "exit"). With a numeric argument, it creates an additional process buffer, in Epsilon environments that support more than one. Epsilon maintains a command history for the concurrent process buffer. You can use Alt-p and Alt-n to retrieve the text of previous commands. With a numeric prefix argument, these keys show a menu of all previous commands. You can select one to repeat. In a concurrent process buffer, you can use the <Tab> key to perform completion on file names, command names, and environments variable names as you're typing them. If no more completion is possible, Epsilon displays all the matches in the echo area, if they fit. If not, press <Tab> again to see them listed in the buffer. See the process-complete command for more details, or the process-completion-style and process-completion-dircmds variables to customize how process buffer completion works. The process-coloring-rules variable controls how Epsilon interprets ANSI escape sequences and similar in a process buffer, and process-echo changes certain echoing functions. The process-enter-whole-line variable customizes how the process buffer behaves when you press <Enter>, or select a previous command from command history.
Under Windows, certain process buffer functions like completion, or
interpreting compiler error messages, require Epsilon to determine the
current directory of the command processor running there. Epsilon
does this by examining each prompt from cmd.exe, such as
As described in the previous section, you can change the name of the shell command processor Epsilon calls, and specify what command line switches Epsilon should pass to it, by setting configuration variables. Some different configuration variable names override those variables, but only when Epsilon starts a subprocess concurrently. For example, you might run a command processor that you have to start with a special flag when Epsilon runs it concurrently. The INTERCONCURSHELLFLAGS and CMDCONCURSHELLFLAGS variables override INTERSHELLFLAGS and CMDSHELLFLAGS, respectively. The EPSCONCURCOMSPEC variable overrides EPSCOMSPEC. For example, one version of the Bash shell for Windows systems requires these settings:
When a concurrent process starts, Epsilon creates a buffer named "process". In this buffer, you can see what the process types and respond to the process's requests for input. If a buffer named "process" already exists, perhaps from running a process previously, Epsilon goes to its end. Provide a numeric argument to the start-process command and it will create an additional process buffer (in those environments where Epsilon supports multiple process buffers).
If you set the variable clear-process-buffer to A program running concurrently behaves as it does when run directly from outside Epsilon except when it prints things on the screen or reads characters from the keyboard. When the program prints characters, Epsilon inserts these in the process buffer. When the program waits for a line of input, Epsilon will suspend the process until it can read a line of input from the process buffer, at which time Epsilon will restart the process and give it the line of input. You can type lines of input before the program requests them, and Epsilon will feed the input to the process as it requests each line. In some environments, Epsilon will also satisfy requests from the concurrent process for single-character input. In detail, Epsilon remembers a particular spot in the process buffer where all input and output takes place. This spot, called the type point, determines what characters from the buffer a program will read when it does input, and where the characters a program types will appear. Epsilon inserts in the buffer, just before the type point, each character a program types. When a process requests a line of input, Epsilon waits until a newline appears in the buffer after the type point, then gives the line to the program, then moves the type point past these characters. (In environments where Epsilon can distinguishes a request by a program to read a single character, it will pause the concurrent process until you have inserted a character after the type point, give that character to the concurrent process, then advance the type point past that character.) You may insert characters into the process buffer in any way you please, typing them directly or using the yank command to retrieve program input from somewhere else. (Also see the process-yank-confirm variable.) You can move about in the process buffer, edit other files, or do anything else at any time, regardless of whether the program has asked the system for keyboard input. To generate an end-of-file condition for DOS or Windows programs reading from the standard input, insert a ^Z character by typing Ctrl-q Ctrl-z on a line by itself, at the end of the buffer. For a Unix program, type Ctrl-q Ctrl-d <Enter>. Some programs will not work when running concurrently. Programs that do cursor positioning or graphics will not work well, since such things do not correspond to a stream of characters coming from the program to insert into a buffer. They may even interfere with what Epsilon displays. We provide the concurrent process facility primarily to let you run programs like compilers, linkers, assemblers, filters, etc. You may rename the buffer named "process" using the rename-buffer command, and start a different, independent concurrent process in the buffer "process". Or run the start-process command with a numeric argument to have Epsilon pick a unique buffer name for the new process buffer if "process" already has an active process. If you exit Epsilon while running a concurrent process, Epsilon kills that process. The exit-process command types "exit" to a running concurrent process. If the concurrent process is running a standard command processor, it should then exit. Also see the process-warn-on-exit and process-warn-on-killing variables. The kill-process command disconnects Epsilon from a concurrent process, and forces it to exit. It operates on the current buffer's process, if any, or on the buffer named "process" if the current buffer has no process. If the current buffer isn't a process buffer but has a running Internet job (such as an ftp:// buffer), this command tries to cancel it. The stop-process command, normally on Ctrl-c Ctrl-c, makes a program running concurrently believe you typed Control-Break (or, for Unix, sends an interrupt signal). It operates on the current buffer's process, if any, or on the buffer named "process" if the current buffer has no process.
|