![]() ![]() While the buffer list is displayed, you can move the cursor to the line of the buffer you want to switch to, then press enter. There are two ways you can switch to a different buffer. ![]() The name of the file, if any, load into the buffer We haven’t discussed modes yet, so don’t worry if this column doesn’t make any sense just yet. From left to right they are: ColumnĪn asterisk (*) is displayed in this column if the buffer has been modified since it was last savedĪ percent sign (%) is displayed in this column if the buffer is read-only It also displays some additional information about each buffer as well. In that window is displayed the list of currently open buffers. This command will split open a new window. To list what buffers are available, use the list buffers command, C-x C-b. You can open a new file, thereby creating new buffers, in either window, and you can switch which buffer is displayed in your current window. I’d be rather disappointed if that’s all we could do, but like most editors, emacs lets you do a lot more than that. Of course opening multiple windows into the same buffer is only of limited utility. To close all windows except the current one, type C-x 1. To close the current window, type C-x 0 (zero this time, not O). Using C-x o repeatedly will cycle the cursor through all of the current windows. Now that you have two (or more) windows open, how do you switch between them? The command C-x o (that’s a lower case O, not a zero) moves the cursor to the Other window. You’ll see the characters you type “echoed” in the opposite window. ![]() Scroll the buffer in each of the two windows so that you’re looking at the same line of text. You can scroll around in each of the windows independently, but because they are two windows into the same buffer and not two buffers, any change you make to the text in one window will also affect the text seen in the other windows. When you split the current windows into two windows with C-x 2 or C-x 3, you see that each of the new windows contains a view into the same buffer (in this case, the buffer containing the alice1.txt file). The simplest way to create new emacs windows is to split the current window in half, either horizontally or vertically. It’s important to learn how to work with emacs windows, as many emacs command will open windows to display their output or to accept input or interaction beyond what can be done in the minibuffer. In a moment we’ll look at how to create more buffers, but first let’s look at how to work with windows. Congratulations! you’ve just created a buffer. If you don’t still have the file saved somewhere, go ahead and download it from the link above. So now that we know what buffers, windows, and frames are (in emacs terminology at least), how do we use them? To begin, lets open the alice1.txt file that we worked with in the last tutorial. ![]() What everyone else in the world calls windows are called “frames” by emacs. Within each “window” you can either display separate buffers, or you can display multiple views into the same buffer. Instead, it meant splitting the screen horizontally and/or vertically two or more times. So in emacs terminology opening a new window didn’t mean creating an overlapping, independent window like you’d expect in a modern GUI. Instead, it ran full screen in a character mode terminal. Remember that emacs originally didn’t run in a windowing GUI. And here is where the antique nature of emacs becomes important. Additionally, there are other specialized buffers, like the minibuffer, buffers that contain the emacs online help system, buffers that are attached to the input/output of a shell or other process, etc.īuffers are displayed in windows and frames. You can also have an unlimited number of scratch buffers, which are buffers that haven’t been saved to a file. However, not every buffer contains a file. In emacs, each file you open is contained in a separate buffer. Why is this important? We’ll see shortly.īut first, lets talk about buffers. Recall that emacs was created waaaay back in the almost prehistoric times before modern windowing interfaces. So let’s look at how to work with multiple files in emacs. But it’s pretty lame to only be able to work on one file at a time. So far, we’ve learned how to open files, save files, and navigate around a file. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |