Книга: Learning GNU Emacs, 3rd Edition

1.8 Saving Files

1.8 Saving Files

To save the file you are editing, type C-x C-s. Emacs writes the file. To let you know that the file was saved, it puts the message Wrote filename in the minibuffer. If you haven't made any changes to the file, Emacs puts the message No changes need to be saved in the minibuffer. You can also get to this option by pressing the diskette on the toolbar or choosing Save (current buffer) from the File menu.

If you decide to save something you've typed in the *scratch* buffer by typing C-x C-s, Emacs asks you for a filename. After you give it a filename, Emacs changes the mode line accordingly.

A related command is write-file(C-x C-w). It is the Emacs equivalent of the Save As option found on many applications' File menus. The write-file command asks you to type a new filename in the minibuffer. However, if you just press Enter instead of typing a new filename, write-file saves the file with its old name—just as C-x C-s would have done. (It does ask if you want to replace the current file with the one in this buffer, however.)

The write-file command is useful for editing files that you do not have permission to change. Use the find-file command to get the file you want into a buffer, and then use write-file to create your own private version, with a different name or path. This maneuver allows you to copy the file to one that you own and can change. Of course, the original file is not affected.

Оглавление книги


Генерация: 0.894. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз