Next: , Previous: , Up: Files   [Contents][Index]


3.3.2 Filename Defaulting and Merging

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.

Hemlock Variable: Pathname Defaults (initial value (pathname "gazonk.del"))
Hemlock Variable: Last Resort Pathname Defaults Function
Hemlock Variable: Last Resort Pathname Defaults (initial value (pathname "gazonk"))

These variables control the computation of default filename defaults when the current buffer has no associated file.

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.

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.

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:

  1. If Hemlock can find the user’s input as a file on the "default:" search list, then it forgoes merging with the displayed default. Basically, the system favors the files in your current working directory over those found by merging with the defaults offered in the prompt.
  2. Merging comes in two flavors, just merge with the displayed default’s directory or just merge with the displayed default’s file-namestring. If the user only responds with a directory specification, without any name or type information, then Hemlock merges the default’s file-namestring. If the user responds with any name or type information, then Hemlock only merges with the default’s directory. Specifying relative directories in this second situation coordinates with the displayed defaults, not the current working directory.

Next: Type Hooks and File Options, Previous: Auto Save Mode, Up: Files   [Contents][Index]