These commands either read a file into the current buffer or write it out to some file. Various other bookkeeping operations are performed as well. [annotate]
This is the command normally used to get a file into Hemlock. It prompts for the name of a file, and if that file has already been read in, selects that buffer; otherwise, it reads file into a new buffer whose name is derived from the name of the file. If the file does not exist, then the buffer is left empty, and "(New File)" is displayed in the echo area; the file may then be created by saving the buffer. [annotate] The buffer name created is in the form "name type directory". This means that the filename "/sys/emacs/teco.mid" has "Teco Mid /Sys/Emacs/" as its the corresponding buffer name. The reason for rearranging the fields in this fashion is that it facilitates recognition since the components most likely to differ are placed first. If the buffer cannot be created because it already exists, but has another file in it (an unlikely occurrence), then the user is prompted for the buffer to use, as by Create Buffer. [annotate] Find File takes special action if the file has been modified on disk since it was read into Hemlock. This usually happens when several people are simultaneously editing a file, an unhealthy circumstance. If the buffer is unmodified, Find File just asks for confirmation before reading in the new version. If the buffer is modified, then Find File beeps and prompts for a single key-event to indicate what action to take. It recognizes the following key-events: [annotate]
[← 13.4 File Reading and Writing, find-file-buffer] [← 6.1.1 Inspecting Directories, Dired View File] [← 5.1 File Groups, Group Find File] [← 5.1 File Groups, Group Search] [← 5.1 File Groups, Group Query Replace] [← 3.3.3 Type Hooks and File Options] [← 3.3 Files, Backup File] [← 3.3 Files, Visit File] [← 1.11 Entering and Exiting] |
This command writes the current buffer out to its associated file and resets the buffer modification flag. If there is no associated file, then the user is prompted for a file, which is made the associated file. If the buffer is not modified, then the user is asked whether to actually write it or not. [annotate] If the file has been modified on disk since the last time it was read, Save File prompts for confirmation before overwriting the file. [annotate] |
| Save All Files | (bound to C-x C-m) | [Command] |
| Save All Files and Exit | (bound to C-x M-z) | [Command] |
| Save All Files Confirm | (initial value t) | [Variable] |
Save All Files does a Save File on all buffers which have an associated file. Save All Files and Exit does the same thing and then exits Hemlock. [annotate] When Save All Files Confirm is true, these commands will ask for confirmation before saving a file. [annotate] |
This command prompts for a file and reads it into the current buffer, setting the associated filename. Since the old contents of the buffer are destroyed, the user is given a chance to save the buffer if it is modified. As for Find File, the file need not actually exist. This command warns if some other buffer also contains the file. [annotate] |
This command prompts for a file and writes the current buffer out to it, changing the associated filename and resetting the modification flag. When the buffer's associated file is specified this command does the same thing as Save File. [annotate] |
This command is similar to Write File, but it neither sets the associated filename nor clears the modification flag. This is useful for saving the current state somewhere else, perhaps on a reliable machine. [annotate] Since Backup File doesn't update the write date for the buffer, Find File and Save File will get all upset if you back up a buffer on any file that has been read into Hemlock. [annotate] |
This command replaces the text in the current buffer with the contents of the associated file or the checkpoint file for that file, whichever is more recent. The point is put in approximately the same place that it was before the file was read. If the original file is reverted to, then clear the modified flag, otherwise leave it set. If a prefix argument is specified, then always revert to the original file, ignoring any checkpoint file. [annotate] If the buffer is modified and Revert File Confirm is true, then the user is asked for confirmation. [annotate] |
This command prompts for a file and inserts it at the point, pushing a buffer mark before inserting. [annotate] |
This command prompts for a file and writes the text in the region out to it. [annotate] |
This variable controls whether some file writing commands add a newline at the end of the file if the last line is non-empty. [annotate]
Some programs will lose the text on the last line or get an error when the last line does not have a newline at the end. [annotate] |
Whenever a file is written by Save File and similar commands, the old file is renamed by appending ".BAK" to the name, ensuring that some version of the file will survive a system crash during the write. If set to true, this backup file will not deleted even when the write successfully completes. [annotate] |
Save mode protects against loss of work in system crashes by periodically saving modified buffers in checkpoint files. [annotate]
This command turns on Save mode if it is not on, and turns off when it is on. Save mode is on by default. [annotate] |
| Auto Save Checkpoint Frequency | (initial value 120) | [Variable] |
| Auto Save Key Count Threshold | (initial value 256) | [Variable] |
These variables determine how often modified buffers in Save mode will be checkpointed. Checkpointing is done after Auto Save Checkpoint Frequency seconds, or after Auto Save Key Count Threshold keystrokes that modify the buffer (whichever comes first). Either kind of checkpointing may be disabled by setting the corresponding variable to nil. [annotate] |
If this variable is true, then any checkpoint file for a buffer will be deleted when the buffer is successfully saved in its associated file. [annotate] |
| Auto Save Filename Pattern | (initial value "~A~A.CKP") | [Variable] |
| Auto Save Pathname Hook | (initial value make-unique-save-pathname) | [Variable] |
These variables determine the naming of checkpoint files. Auto Save Filename Pattern is a format string used to name the checkpoint files for buffers with associated files. Format is called with two arguments: the directory and file namestrings of the associated file. [annotate] Auto Save Pathname Hook is a function called by Save mode to get a checkpoint pathname when there is no pathname associated with a buffer. It should take a buffer as its argument and return either a pathname or nil. If a pathname is returned, then it is used as the name of the checkpoint file. If the function returns nil, or if the hook variable is nil, then Save mode is turned off in the buffer. The default value for this variable returns a pathname in the default directory of the form "save-number", where number is a number used to make the file unique. [annotate] |
When Hemlock prompts for the name of a file, it always offers a default. Except for a few commands that have their own defaults, filename defaults are computed in a standard way. If it exists, the associated file for the current buffer is used as the default, otherwise a more complex mechanism creates a default. [annotate]
| Pathname Defaults | (initial value (pathname "gazonk.del")) | [Variable] |
| Last Resort Pathname Defaults Function | (initial value ) | [Variable] |
| Last Resort Pathname Defaults | (initial value (pathname "gazonk")) | [Variable] |
These variables control the computation of default filename defaults when the current buffer has no associated file. [annotate] Pathname Defaults holds a "sticky" filename default. Commands that prompt for files set this to the file specified, and the value is used as a basis for filename defaults. It is undesirable to offer the unmodified value as a default, since it is usually the name of an existing file that we don't want to overwrite. If the current buffer's name is all alphanumeric, then the default is computed by substituting the buffer name for the the name portion of Pathname Defaults. Otherwise, the default is computed by calling Last Resort Pathname Defaults Function with the buffer as an argument. [annotate] The default value of Last Resort Pathname Defaults Function merges Last Resort Pathname Defaults with Pathname Defaults. Unlike Pathname Defaults, Last Resort Pathname Defaults is not modified by file commands, so setting it to a silly name ensures that real files aren't inappropriately offered as defaults. [annotate] |
When a default is present in the prompt for a file, Hemlock merges the given input with the default filename. The semantics of merging, described in the Common Lisp manual, is somewhat involved, but Hemlock has a few rules it uses: [annotate]
When a file is read either by Find File or Visit File, Hemlock attempts to guess the correct mode in which to put the buffer, based on the file's type (the part of the filename after the last dot). Any default action may be overridden by specifying the mode in the file's file options. [annotate]
The user specifies file options with a special syntax on the first line of a file. If the first line contains the string "-*-", then Hemlock interprets the text between the first such occurrence and the second, which must be contained in one line , as a list of "option: value" pairs separated by semicolons. The following is a typical example: ;;; -*- Mode: Lisp, Editor; Package: Hemlock -*- [annotate]
These options are currently defined: [annotate]
If the option list contains no ":" then the entire string is used as the name of the major mode for the buffer. [annotate]
This command processes the file options in the current buffer as described above. This is useful when the options have been changed or when a file is created. [annotate] |