Next: , Previous: , Up: Shell   [Contents][Index]


26.7.4 Interactive Inferior Shell with Terminal Emulator

To run a subshell in a terminal emulator, putting its typescript in an SXEmacs buffer, use M-x term. This creates (or reuses) a buffer named ‘*term*’ and runs a subshell with input coming from your keyboard and output going to that buffer.

All the normal keys that you type are sent without any interpretation by SXEmacs directly to the subshell, as “terminal input.” Any “echo” of your input is the responsibility of the subshell. (The exception is the terminal escape character, which by default is C-c. see Term Mode.) Any “terminal output” from the subshell goes into the buffer, advancing point.

Some programs (such as SXEmacs itself) need to control the appearance on the terminal screen in detail. They do this by sending special control codes. The exact control codes needed vary from terminal to terminal, but nowadays most terminals and terminal emulators (including xterm) understand the so-called "ANSI escape sequences" (first popularized by the Digital’s VT100 family of terminal). The term mode also understands these escape sequences, and for each control code does the appropriate thing to change the buffer so that the appearance of the window will match what it would be on a real terminal. Thus you can actually run SXEmacs inside an SXEmacs Term window!

SXEmacs does not wait for the subshell to do anything. You can switch windows or buffers and edit them while the shell is waiting, or while it is running a command. Output from the subshell waits until SXEmacs has time to process it; this happens whenever SXEmacs is waiting for keyboard input or for time to elapse.

To make multiple terminal emulators, rename the buffer ‘*term*’ to something different using M-x rename-uniquely, just as with Shell mode.

The file name used to load the subshell is determined the same way as for Shell mode.

Unlike Shell mode, Term mode does not track the current directory by examining your input. Instead, if you use a programmable shell, you can have it tell Term what the current directory is. This is done automatically by bash for version 1.15 and later.


Next: , Previous: , Up: Shell   [Contents][Index]