Go to the first, previous, next, last section, table of contents.


Standard File Names

Most of the file names used in Lisp programs are entered by the user. But occasionally a Lisp program needs to specify a standard file name for a particular use--typically, to hold customization information about each user. For example, abbrev definitions are stored (by default) in the file `~/.abbrev_defs'; the completion package stores completions in the file `~/.completions'. These are two of the many standard file names used by parts of Emacs for certain purposes.

Various operating systems have their own conventions for valid file names and for which file names to use for user profile data. A Lisp program which reads a file using a standard file name ought to use, on each type of system, a file name suitable for that system. The function convert-standard-filename makes this easy to do.

Function: convert-standard-filename filename
This function alters the file name filename to fit the conventions of the operating system in use, and returns the result as a new string.

The recommended way to specify a standard file name in a Lisp program is to choose a name which fits the conventions of GNU and Unix systems, usually with a nondirectory part that starts with a period, and pass it to convert-standard-filename instead of using it directly. Here is an example from the completion package:

(defvar save-completions-file-name
        (convert-standard-filename "~/.completions")
  "*The file name to save completions to.")

On GNU and Unix systems, and on some other systems as well, convert-standard-filename returns its argument unchanged. On some other systems, it alters the name to fit the system's conventions.

For example, on MS-DOS the alterations made by this function include converting a leading `.' to `_', converting a `_' in the middle of the name to `.' if there is no other `.', inserting a `.' after eight characters if there is none, and truncating to three characters after the `.'. (It makes other changes as well.) Thus, `.abbrev_defs' becomes `_abbrev.def', and `.completions' becomes `_complet.ion'.


Go to the first, previous, next, last section, table of contents.