LispWorks Editor User Guide > 3 Command Reference > 3.5 File handling

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 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. The selected buffers are saved.

With a non-nil prefix argument, no such dialog is displayed and all buffers that need saving are saved. You can also prevent the Save Selected Buffers dialog from being displayed by setting the value of the editor variable save-all-files-confirm.

save-all-files-confirm

Editor Variable

Default value: t

When the value is true, Save All Files prompts for confirmation before writing the modified buffers, when used without a prefix argument.

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

Controls whether the commands Save File and Write File add a newline at the end of the file if the last line is non-empty.

If the value of this variable is t then the commands add a newline and tell the user. If its value is nil the commands never add a newline.

If the value is t then the commands add a newline and tell the user. If the value is nil the commands never add a newline. If the value is :ask-user , the commands ask whether to add a newline.

output-format-default

Editor Variable

Default value: nil

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 and Reference Manual 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.

The default value of output-format-default is nil .

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 and Reference Manual for a description of external format specifications.

Find Unwritable Character

Editor Command

Arguments: None
Key sequence: None

Finds the next occurrence of a character in the current buffer that cannot be written using the buffer external format. The prefix argument is ignored.

List Unwritable Characters

Editor Command

Arguments: None
Key sequence: None

Lists the characters in the current buffer that cannot be written with the buffer external format. The prefix argument is ignored.


LispWorks Editor User Guide (Unix version) - 22 Dec 2009

NextPrevUpTopContentsIndex