: Learning GNU Emacs, 3rd Edition

5.1 Executing Commands in Shell Buffers

One of the most important features of Emacs is its ability to run a command shell in a buffer. Once you have started a shell buffer, you can do all of your normal command-line work within Emacs. What does this buy you?

You don't have to leave Emacs to get a command prompt. If you want to print or compile a file that you're editing, you can do it immediately.

You can use Emacs editing features to write your commands.

You can use Emacs editing features to "back up" through your command list, copy an old command, modify it, and execute it again.

You can save your shell buffer, keeping a transcript of your editing sessionwhich automatically includes the output from every command that you ran. For debugging or remembering commands you run infrequently, this can be invaluable.

You can copy output from commands into a file or into another command.

You can save complex commands in a file and insert the file at the prompt, rather than retyping the command.

As you get used to working within Emacs, you will undoubtedly discover more and more ways to put shell mode to use.

In this section, we discuss shell mode. Later in this chapter, we discuss directory editing, printing, and calendar and diary features for doing simple time management in Emacs. Right now, we'll start with a simple variation on shell mode, a feature that lets you execute commands one at a time.


: 0.260. /Cache: 3 / 1