NextPrevUpTopContentsIndex

3.5.2 Saving files

Save File

Editor Command

Arguments: None
Key sequence: Ctrl+X Ctrl+S

editor:save-file-command p &optional buffer

Saves the contents of the current buffer to the associated file. If there is no associated file, one is created with the same name as the buffer, and written in the same encoding as specified by the editor variable Output-Format-Default, or as defaulted by open if this is nil .

The argument buffer is the buffer to be saved in its associated file. The default is the current buffer.

Save All Files

Editor Command

Arguments: None
Key sequence: Ctrl+X S

Without a prefix argument, a Save Selected Buffers window is displayed asking whether each modified buffer is to be saved. If a buffer has no associated file it is ignored, even if it is modified. The selected buffers are saved.

With a non- nil prefix argument, no such dialog is displayed and all buffers that need saving are saved.

Write File

Editor Command

Arguments: pathname
Key sequence: Ctrl+X Ctrl+W pathname

editor:write-file-command p &optional pathname buffer

Writes the contents of the current buffer to the file defined by pathname . If the file already exists, it is overwritten. If the file does not exist, it is created. The buffer then becomes associated with the new file.

The argument buffer is the name of the buffer whose contents are to be written. The default is the current buffer.

Write Region

Editor Command

Arguments: pathname
Key sequence: None

editor:write-region-command p &optional pathname

Writes the region between the mark and the current point to the file defined by pathname . If the file already exists, it is overwritten. If the file does not exist, it is created.

Append to File

Editor Command

Arguments: pathname
Key sequence: None

Appends the region between the mark and the current point to the file defined by pathname . If the file does not exist, it is created.

Backup File

Editor Command

Arguments: pathname
Key sequence: None

Writes the contents of the current buffer to the file defined by pathname . If the file already exists, it is overwritten. If it does not exist, it is created.

In contrast with Write File, no change is made concerning the file associated with the current buffer as this command is only intended to be used to write the contents of the current buffer to a backup file.

Save All Files and Exit

Editor Command

Arguments: None
Key sequence: Ctrl+X Ctrl+C

A Save Selected Buffers dialog is displayed asking whether each modified buffer is to be saved. If a buffer has no associated file it is ignored, even if it is modified (this operates just like Save All Files). When all the required buffers have been saved LispWorks exits, prompting for confirmation first.

Add-Newline-at-EOF-on-Writing-File

Editor Variable

Default value: :ask-user

If the value of this variable is t , a newline is automatically added to the end of any file that lacks one when the file is being saved. If its value is nil , no newline is added in this way.

Its default value is :ask-user , so the user is prompted about adding the newline when necessary.

Output-Format-Default

Editor Variable

The default external format used for writing buffers to files.

If the buffer already has an external format (either it has been read from a file, or Set External Format has been used to specify an external format) then Output-Format-Default is ignored. If the value is nil and the buffer does not have an external format, cl:open chooses the external format to use.

The value should be nil or an external format specification. See the LispWorks User Guide for a description of these and of how cl:open chooses an external format.

If you have specified an output encoding via the Editor tool's Preferences dialog, then Output-Format-Default is initialized to that value on startup.

Set External Format

Editor Command

Arguments: buffer
Key sequence: None

Prompts for an external format specification, providing a default which is the buffer's current external format if set, or the value of Output-Format-Default. Sets the buffer's external format, so that this is used for subsequent file writing and reading.

If a non- nil prefix argument is supplied, the buffer's external format is set to the value of Output-Format-Default without prompting.

See the LispWorks User Guide for a description of external format specifications.


LispWorks Editor User Guide (Windows version) - 23 Feb 2006

NextPrevUpTopContentsIndex