Emacs opens a new frame on dickens
.
If you type C-x bto move to another buffer, the name at the top of the frame changes to the new buffer's name (and on Linux, it shows the path as well). To move to a buffer and put it in a new frame, type C-x 5 b. You might have guessed that one.
4.4.2 Moving Between Frames
You can move between frames in several ways. You can use the mouse to select a frame or press C-x 5 oto go to another frame. To see a list of current frames, select Framesfrom the Buffersmenu. (If you have only one frame, the Framesoption does not appear on this menu.)
4.4.3 Deleting and Minimizing Frames
To get rid of a frame, press C-x 5 0. Emacs deletes the frame you are in. Deleting a frame, like deleting a window, affects only the display. The underlying buffer is still active, and you can move to it by typing C-x b.
If you try to use C-x 5 0to delete the only frame that is left, Emacs won't do it. To exit Emacs, type C-x C-cor close the frame as you would any other GUI window using the mouse.
To minimize a frame, either minimize it in the usual way or press C-z. Table 4-1summarizes the frame commands.
Table 4-1. Frame commands
Keystrokes |
Command name |
Action |
C-x 5 o Buffers → Frames |
other-frame |
Move to other frame. |
C-x 5 0 File → Delete Frame |
delete-frame |
Delete current frame. |
C-x 5 2 File → New Frame |
make-frame |
Create a new frame on the current buffer. |
C-x 5 f |
find-file-other-frame |
Find file in a new frame. |
C-x 5 r |
find-file-read-only-other-frame |
Finds a file in a new frame, but it is read-only. |
C-x 5 b |
switch-to-buffer-other-frame |
Make frame and display other buffer in it. |
In this section, we'll learn about saving multiple buffers, renaming buffers, read-only buffers, and operations you can do with the buffer list—not only a useful tool but a good introduction to the principles you'll encounter in the directory editor, Dired, covered in Chapter 5 Chapter 5. Emacs as a Work Environment Many of the everyday things you do from a command prompt can be done from within Emacs. You can execute commands, work with directories, and print files—all without leaving Emacs. Changing tasks is as simple as jumping between buffers. What's important about this? Of course, it's nice to be able to move between tasks easily. What's even more important is that you have the same editing environment no matter what you're doing: you can use all of the Emacs editing commands to work on a file, give shell commands, then start up Dired, the directory editor, to do some file maintenance. It is simple to move text from one window to another. You can execute a command and then use Emacs commands to cut and paste the results into a file. If you're trying to compile a program and keep getting error messages, you can save the interactive session as a file and confer with someone about the problem. Despite the many advantages of modern window systems, Emacs often provides the best way to integrate the many kinds of work you do daily. Much of the information in this chapter involves integration between Emacs and the operating system. Emacs is most commonly a Unix editor, so forgive us for a bias in that direction. But we are happy to report that for users of GNU Emacs on other platforms, integration with the operating system is still available; you can use shell mode to run commands and can edit directories with Dired. There's no reason to leave Emacs no matter what your platform is.
.
4.5.1 Saving Multiple Buffers
You know about saving buffers individually by typing C-x C-s. Once you're using multiple buffers, you should also know that you can save them all at once by typing C-x s(for save-some-buffers). Emacs asks you if you want to save each buffer that is connected with a file (it doesn't offer to save new buffers you've created but have not associated with a file and, of course, it doesn't save its own internal buffers). For each buffer, you can answer yto save it or nnot to. You can also type !to save all the buffers without asking. If you want to save this buffer and no more, type a period ( .). If you want to cancel the command and not save the current buffer, press q(of course, any buffers you saved before pressing qare already saved; qdoes not undo those). You may want to look at the buffer before deciding whether to save it; if so, type C-r. Emacs enters view mode, allowing you to look at the buffer but not make changes. Press qto exit view mode and continue saving buffers.
When you are editing a file, the buffer takes on the name of the file. If you have long filenames, you may find it convenient to rename buffers to shorter names (this renaming doesn't affect the filename, just the buffer name). This feature is mostly useful on versions of Emacs that don't offer good completion capabilities; in GNU Emacs, whenever you have to type a buffer name, you just type the first few unique letters and press Tabto have Emacs complete the name for you. In some circumstances, you may want to rename buffers.
To rename a buffer, type M-x rename-buffer. Emacs asks for the new name; type it and press Enter. The new name is displayed on the mode line. Renaming buffers comes in particularly handy in shell mode, described in Chapter 5 Chapter 5. Emacs as a Work Environment Many of the everyday things you do from a command prompt can be done from within Emacs. You can execute commands, work with directories, and print files—all without leaving Emacs. Changing tasks is as simple as jumping between buffers. What's important about this? Of course, it's nice to be able to move between tasks easily. What's even more important is that you have the same editing environment no matter what you're doing: you can use all of the Emacs editing commands to work on a file, give shell commands, then start up Dired, the directory editor, to do some file maintenance. It is simple to move text from one window to another. You can execute a command and then use Emacs commands to cut and paste the results into a file. If you're trying to compile a program and keep getting error messages, you can save the interactive session as a file and confer with someone about the problem. Despite the many advantages of modern window systems, Emacs often provides the best way to integrate the many kinds of work you do daily. Much of the information in this chapter involves integration between Emacs and the operating system. Emacs is most commonly a Unix editor, so forgive us for a bias in that direction. But we are happy to report that for users of GNU Emacs on other platforms, integration with the operating system is still available; you can use shell mode to run commands and can edit directories with Dired. There's no reason to leave Emacs no matter what your platform is.
. You start one command shell, and then rename the buffer and start another, in this way running as many shells as you have use for simultaneously.
Читать дальше