4.5.3 Read-Only Buffers
4.5.3 Read-Only Buffers
While you're working, you may need to read some file that you don't want to change: you just want to browse through it and look at its contents. Of course, it is easy to touch the keyboard accidentally and make spurious modifications. We've discussed several ways to restore the original file, but it would be better to prevent this from happening at all. How?
You can make any buffer read-only by pressing C-x C-q. Try this on a practice buffer and you'll notice that two percent signs (
%%) appear on the left side of the mode line, in the same place where asterisks (
**) appear if you've changed a buffer. The percent signs indicate that the buffer is read-only. If you try to type in a read-only buffer, Emacs just beeps at you and displays an error message (
Buffer is read-only) in the minibuffer. What happens when you change your mind and want to start editing the read-only buffer again? Just type C-x C-q again. This command toggles the buffer's read-only status—that is, typing C-x C-q repeatedly makes the buffer alternate between read-only and read-write.
Of course, toggling read-only status doesn't change the permissions on a file. If you are editing a buffer containing someone else's file, C-x C-q does not change the read-only status. One way to edit someone else's file is to make a copy of your own using the write-file command, and then make changes. Let's say you want to change a proposal that is owned by someone else. Read the file, write the file as one you own using C-x C-w, then change it from read-only to writable status by pressing C-x C-q. None of this, of course, modifies the original file; it just gives you a copy to work with. If you want to move a minor amount of text from a read-only file to another, you can mark the text then press M-w to copy it. Move to the place you want to put the text and press C-y to paste it.
You can open a file as read-only in a new window by typing C-x 4 r or in a new frame by typing C-x 5 r. This is one of a number of commands in which 4 means window and 5 means frame.
- 4.5 More About Buffers
- Page buffers
- Класс StreamReader
- How to read
- 6.6.5 SIGEV_THREAD
- При запуске программы появляется сообщение Инструкция по адресу 0х77ddb1d1 обратилась к памяти по адресу 0x0080002c. Пам...
- В Adobe Acrobat Reader русский текст на экране читается нормально, а при печати получается текст из набора символов. Как...
- 4 A few ways to use threads
- DirectX Tutorial 4: Full Screen and Depth Buffers
- Reading Documentation
- RSS Readers
- The Pan News Client Newsreader