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

NextPrevUpTopContentsIndex

3.5.1 Finding files

Find File

Editor Command

Arguments: pathname
Key sequence: None

editor:find-file-command p &optional pathname

Finds a new buffer with the same name as pathname (where pathname is the name of the file to be found, including its directory relative to the current directory), creating it if necessary, and inserts the contents of the file into the buffer. The contents of the buffer are displayed in an editor pane and may then be edited.

The file is initially read in the external format (encoding) given by the editor variable input-format-default. If the value of this is nil , cl:open chooses the external format to use. The external format is remembered for subsequent reading and writing of the buffer, and its name is displayed in the mode line, and its name is displayed in the mode line.

If the file is already being visited a new buffer is not created, but the buffer already containing the contents of that file is displayed instead.

If a file with the specified name does not exist, an empty buffer with that file name is created for editing purposes, but the new file is not created until the appropriate save file command is issued.

If there is no prefix argument, a new Editor window is created for the file. With any prefix argument, the file is shown in the current window.

Another version of this command is Wfind File which is usually used for finding files.

Wfind File

Editor Command

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

editor:wfind-file-command p &optional pathname

Calls Find File with a prefix argument (that is, the new file is opened in the existing window).

Visit File

Editor Command

Arguments: pathname
Key sequence: None

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

Does the same as Find Alternate File, and then sets the buffer to be writable.

Find Alternate File

Editor Command

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

editor:find-alternate-file-command p &optional pathname buffer

Does the same as Find File with a prefix argument, but kills the current buffer and replaces it with the newly created buffer containing the file requested. If the contents of the buffer to be killed have been modified, the user is asked if the changes are to be saved to file.

The argument buffer is the buffer in which the contents of the file are to be displayed. buffer defaults to the current buffer.

The prefix argument is ignored.

input-format-default

Editor Variable

Default value: nil

The default external format used by Find File, Wfind File and Visit File for reading files into buffers.

If the buffer already has an external format (either it has previously been read from a file, or Set External Format has been used to specify an external format) then input-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 input encoding via the Editor tool's Preferences dialog, then input-format-default is initialized to that value on startup.


LispWorks Editor User Guide (Unix version) - 3 May 2011

NextPrevUpTopContentsIndex