home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / GNU / emacs.inst / emacs19.idb / usr / gnu / info / elisp-18.z / elisp-18
Encoding:
GNU Info File  |  1994-08-02  |  46.6 KB  |  1,188 lines

  1. This is Info file elisp, produced by Makeinfo-1.55 from the input file
  2. elisp.texi.
  3.  
  4.    This version is newer than the second printed edition of the GNU
  5. Emacs Lisp Reference Manual.  It corresponds to Emacs Version 19.19.
  6.  
  7.    Published by the Free Software Foundation 675 Massachusetts Avenue
  8. Cambridge, MA 02139 USA
  9.  
  10.    Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided that
  18. the entire resulting derived work is distributed under the terms of a
  19. permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions, except that this permission notice may be stated in a
  24. translation approved by the Foundation.
  25.  
  26.    Permission is granted to copy and distribute modified versions of
  27. this manual under the conditions for verbatim copying, provided also
  28. that the section entitled "GNU Emacs General Public License" is included
  29. exactly as in the original, and provided that the entire resulting
  30. derived work is distributed under the terms of a permission notice
  31. identical to this one.
  32.  
  33.    Permission is granted to copy and distribute translations of this
  34. manual into another language, under the above conditions for modified
  35. versions, except that the section entitled "GNU Emacs General Public
  36. License" may be included in a translation approved by the Free Software
  37. Foundation instead of in the original English.
  38.  
  39. 
  40. File: elisp,  Node: File Attributes,  Prev: Truenames,  Up: Information about Files
  41.  
  42. Other Information about Files
  43. -----------------------------
  44.  
  45.    This section describes the functions for getting detailed information
  46. about a file, other than its contents.  This information includes the
  47. mode bits that control access permission, the owner and group numbers,
  48. the number of names, the inode number, the size, and the times of access
  49. and modification.
  50.  
  51.  - Function: file-modes FILENAME
  52.      This function returns the mode bits of FILENAME, as an integer.
  53.      The mode bits are also called the file permissions, and they
  54.      specify access control in the usual Unix fashion.  If the
  55.      low-order bit is 1, then the file is executable by all users, if
  56.      the second lowest-order bit is 1, then the file is writable by all
  57.      users, etc.
  58.  
  59.      The highest value returnable is 4095 (7777 octal), meaning that
  60.      everyone has read, write, and execute permission, that the SUID bit
  61.      is set for both others and group, and that the sticky bit is set.
  62.  
  63.           (file-modes "~/junk/diffs")
  64.                => 492               ; Decimal integer.
  65.           (format "%o" 492)
  66.                => 754               ; Convert to octal.
  67.           
  68.           (set-file-modes "~/junk/diffs" 438)
  69.                => nil
  70.           
  71.           (format "%o" 438)
  72.                => 666               ; Convert to octal.
  73.           
  74.           % ls -l diffs
  75.             -rw-rw-rw-  1 lewis 0 3063 Oct 30 16:00 diffs
  76.  
  77.  - Function: file-nlinks FILENAME
  78.      This functions returns the number of names (i.e., hard links) that
  79.      file FILENAME has.  If the file does not exist, then this function
  80.      returns `nil'.  Note that symbolic links have no effect on this
  81.      function, because they are not considered to be names of the files
  82.      they link to.
  83.  
  84.           % ls -l foo*
  85.           -rw-rw-rw-  2 rms       4 Aug 19 01:27 foo
  86.           -rw-rw-rw-  2 rms       4 Aug 19 01:27 foo1
  87.           
  88.           (file-nlinks "foo")
  89.                => 2
  90.           (file-nlinks "doesnt-exist")
  91.                => nil
  92.  
  93.  - Function: file-attributes FILENAME
  94.      This function returns a list of attributes of file FILENAME.  If
  95.      the specified file cannot be opened, it returns `nil'.
  96.  
  97.      The elements of the list, in order, are:
  98.  
  99.        0. `t' for a directory, a string for a symbolic link (the name
  100.           linked to), or `nil' for a text file.
  101.  
  102.        1. The number of names the file has.  Alternate names, also
  103.           known as hard links, can be created by using the
  104.           `add-name-to-file' function (*note Changing File
  105.           Attributes::.).
  106.  
  107.        2. The file's UID.
  108.  
  109.        3. The file's GID.
  110.  
  111.        4. The time of last access, as a list of two integers.  The
  112.           first integer has the high-order 16 bits of time, the second
  113.           has the low 16 bits.  (This is similar to the value of
  114.           `current-time'; see *Note Time of Day::.)
  115.  
  116.        5. The time of last modification as a list of two integers (as
  117.           above).
  118.  
  119.        6. The time of last status change as a list of two integers (as
  120.           above).
  121.  
  122.        7. The size of the file in bytes.
  123.  
  124.        8. The file's modes, as a string of ten letters or dashes as in
  125.           `ls -l'.
  126.  
  127.        9. `t' if the file's GID would change if file were deleted and
  128.           recreated; `nil' otherwise.
  129.  
  130.       10. The file's inode number.
  131.  
  132.       11. The file system number of the file system that the file is
  133.           in.  This element together with the file's inode number, give
  134.           enough information to distinguish any two files on the
  135.           system--no two files can have the same values for both of
  136.           these numbers.
  137.  
  138.      For example, here are the file attributes for `files.texi':
  139.  
  140.           (file-attributes "files.texi")
  141.                =>  (nil
  142.                     1
  143.                     2235
  144.                     75
  145.                     (8489 20284)
  146.                     (8489 20284)
  147.                     (8489 20285)
  148.                     14906
  149.                     "-rw-rw-rw-"
  150.                     nil
  151.                     129500
  152.                     -32252)
  153.  
  154.      and here is how the result is interpreted:
  155.  
  156.     `nil'
  157.           is neither a directory nor a symbolic link.
  158.  
  159.     `1'
  160.           has only one name (the name `files.texi' in the current
  161.           default directory).
  162.  
  163.     `2235'
  164.           is owned by the user with UID 2235.
  165.  
  166.     `75'
  167.           is in the group with GID 75.
  168.  
  169.     `(8489 20284)'
  170.           was last accessed on Aug 19 00:09.  Unfortunately, you cannot
  171.           convert this number into a time string in Emacs.
  172.  
  173.     `(8489 20284)'
  174.           was last modified on Aug 19 00:09.
  175.  
  176.     `(8489 20285)'
  177.           last had its inode changed on Aug 19 00:09.
  178.  
  179.     `14906'
  180.           is 14906 characters long.
  181.  
  182.     `"-rw-rw-rw-"'
  183.           has a mode of read and write access for the owner, group, and
  184.           world.
  185.  
  186.     `nil'
  187.           would retain the same GID if it were recreated.
  188.  
  189.     `129500'
  190.           has an inode number of 129500.
  191.  
  192.     `-32252'
  193.           is on file system number -32252.
  194.  
  195. 
  196. File: elisp,  Node: Contents of Directories,  Next: Create/Delete Dirs,  Prev: Information about Files,  Up: Files
  197.  
  198. Contents of Directories
  199. =======================
  200.  
  201.    A directory is a kind of file that contains other files entered under
  202. various names.  Directories are a feature of the file system.
  203.  
  204.    Emacs can list the names of the files in a directory as a Lisp list,
  205. or display the names in a buffer using the `ls' shell command.  In the
  206. latter case, it can optionally display information about each file,
  207. depending on the value of switches passed to the `ls' command.
  208.  
  209.  - Function: directory-files DIRECTORY &optional FULL-NAME MATCH-REGEXP
  210.           NOSORT
  211.      This function returns a list of the names of the files in the
  212.      directory DIRECTORY.  By default, the list is in alphabetical
  213.      order.
  214.  
  215.      If FULL-NAME is non-`nil', the function returns the files'
  216.      absolute file names.  Otherwise, it returns just the names
  217.      relative to the specified directory.
  218.  
  219.      If MATCH-REGEXP is non-`nil', this function returns only those
  220.      file names that contain that regular expression--the other file
  221.      names are discarded from the list.
  222.  
  223.      If NOSORT is non-`nil', that inhibits sorting the list, so you get
  224.      the file names in no particular order.  Use this if you want the
  225.      utmost possible speed and don't care what order the files are
  226.      processed in.  If the order of processing is visible to the user,
  227.      then the user will probably be happier if you do sort the names.
  228.  
  229.           (directory-files "~lewis")
  230.                => ("#foo#" "#foo.el#" "." ".."
  231.                    "dired-mods.el" "files.texi"
  232.                    "files.texi.~1~")
  233.  
  234.      An error is signaled if DIRECTORY is not the name of a directory
  235.      that can be read.
  236.  
  237.  - Function: file-name-all-versions FILE DIRNAME
  238.      This function returns a list of all versions of the file named
  239.      FILE in directory DIRNAME.
  240.  
  241.  - Function: insert-directory FILE SWITCHES &optional WILDCARD
  242.           FULL-DIRECTORY-P
  243.      This function inserts a directory listing for directory DIR,
  244.      formatted according to SWITCHES.  It leaves point after the
  245.      inserted text.
  246.  
  247.      The argument DIR may be either a directory name or a file
  248.      specification including wildcard characters.  If WILDCARD is
  249.      non-`nil', that means treat FILE as a file specification with
  250.      wildcards.
  251.  
  252.      If FULL-DIRECTORY-P is non-`nil', that means FILE is a directory
  253.      and switches do not contain `d', so that a full listing is
  254.      expected.
  255.  
  256.      This function works by running a directory listing program whose
  257.      name is in the variable `insert-directory-program'.  If WILDCARD is
  258.      non-`nil', it also runs the shell specified by `shell-file-name',
  259.      to expand the wildcards.
  260.  
  261.  - Variable: insert-directory-program
  262.      This variable's value is the program to run to generate a
  263.      directory listing for the function `insert-directory'.
  264.  
  265. 
  266. File: elisp,  Node: Create/Delete Dirs,  Next: Changing File Attributes,  Prev: Contents of Directories,  Up: Files
  267.  
  268. Creating and Deleting Directories
  269. =================================
  270.  
  271.  - Function: make-directory DIRNAME
  272.      This function creates a directory named DIRNAME.
  273.  
  274.  - Function: delete-directory DIRNAME
  275.      This function deletes the directory named DIRNAME.  The function
  276.      `delete-file' does not work for files that are directories; you
  277.      must use `delete-directory' in that case.
  278.  
  279. 
  280. File: elisp,  Node: Changing File Attributes,  Next: File Names,  Prev: Create/Delete Dirs,  Up: Files
  281.  
  282. Changing File Names and Attributes
  283. ==================================
  284.  
  285.    The functions in this section rename, copy, delete, link, and set the
  286. modes of files.
  287.  
  288.    In the functions that have an argument NEWNAME, if a file by the
  289. name of NEWNAME already exists, the actions taken depend on the value
  290. of the argument OK-IF-ALREADY-EXISTS:
  291.  
  292.    * A `file-already-exists' error is signaled if OK-IF-ALREADY-EXISTS
  293.      is `nil'.
  294.  
  295.    * Confirmation is requested if OK-IF-ALREADY-EXISTS is a number.
  296.  
  297.    * No confirmation is requested if OK-IF-ALREADY-EXISTS is any other
  298.      value, in which case the old file is removed.
  299.  
  300.  - Function: add-name-to-file OLDNAME NEWNAME &optional
  301.           OK-IF-ALREADY-EXISTS
  302.      This function gives the file named OLDNAME the additional name
  303.      NEWNAME.  This means that NEWNAME becomes a new "hard link" to
  304.      OLDNAME.
  305.  
  306.      In the first part of the following example, we list two files,
  307.      `foo' and `foo3'.
  308.  
  309.           % ls -l fo*
  310.           -rw-rw-rw-  1 rms       29 Aug 18 20:32 foo
  311.           -rw-rw-rw-  1 rms       24 Aug 18 20:31 foo3
  312.  
  313.      Then we evaluate the form `(add-name-to-file "~/lewis/foo"
  314.      "~/lewis/foo2")'.  Again we list the files.  This shows two names,
  315.      `foo' and `foo2'.
  316.  
  317.           (add-name-to-file "~/lewis/foo1" "~/lewis/foo2")
  318.                => nil
  319.           
  320.           % ls -l fo*
  321.           -rw-rw-rw-  2 rms       29 Aug 18 20:32 foo
  322.           -rw-rw-rw-  2 rms       29 Aug 18 20:32 foo2
  323.           -rw-rw-rw-  1 rms       24 Aug 18 20:31 foo3
  324.  
  325.      Finally, we evaluate the following:
  326.  
  327.           (add-name-to-file "~/lewis/foo" "~/lewis/foo3" t)
  328.  
  329.      and list the files again.  Now there are three names for one file:
  330.      `foo', `foo2', and `foo3'.  The old contents of `foo3' are lost.
  331.  
  332.           (add-name-to-file "~/lewis/foo1" "~/lewis/foo3")
  333.                => nil
  334.           
  335.           % ls -l fo*
  336.           -rw-rw-rw-  3 rms       29 Aug 18 20:32 foo
  337.           -rw-rw-rw-  3 rms       29 Aug 18 20:32 foo2
  338.           -rw-rw-rw-  3 rms       29 Aug 18 20:32 foo3
  339.  
  340.      This function is meaningless on VMS, where multiple names for one
  341.      file are not allowed.
  342.  
  343.      See also `file-nlinks' in *Note File Attributes::.
  344.  
  345.  - Command: rename-file FILENAME NEWNAME &optional OK-IF-ALREADY-EXISTS
  346.      This command renames the file FILENAME as NEWNAME.
  347.  
  348.      If FILENAME has additional names aside from FILENAME, it continues
  349.      to have those names.  In fact, adding the name NEWNAME with
  350.      `add-name-to-file' and then deleting FILENAME has the same effect
  351.      as renaming, aside from momentary intermediate states.
  352.  
  353.      In an interactive call, this function prompts for FILENAME and
  354.      NEWNAME in the minibuffer; also, it requests confirmation if
  355.      NEWNAME already exists.
  356.  
  357.  - Command: copy-file OLDNAME NEWNAME &optional OK-IF-EXISTS TIME
  358.      This command copies the file OLDNAME to NEWNAME.  An error is
  359.      signaled if OLDNAME does not exist.
  360.  
  361.      If TIME is non-`nil', then this functions gives the new file the
  362.      same last-modified time that the old one has.  (This works on only
  363.      some operating systems.)
  364.  
  365.      In an interactive call, this function prompts for FILENAME and
  366.      NEWNAME in the minibuffer; also, it requests confirmation if
  367.      NEWNAME already exists.
  368.  
  369.  - Command: delete-file FILENAME
  370.      This command deletes the file FILENAME, like the shell command `rm
  371.      FILENAME'.  If the file has multiple names, it continues to exist
  372.      under the other names.
  373.  
  374.      A suitable kind of `file-error' error is signaled if the file does
  375.      not exist, or is not deletable.  (In Unix, a file is deletable if
  376.      its directory is writable.)
  377.  
  378.      See also `delete-directory' in *Note Create/Delete Dirs::.
  379.  
  380.  - Command: make-symbolic-link FILENAME NEWNAME &optional OK-IF-EXISTS
  381.      This command makes a symbolic link to FILENAME, named NEWNAME.
  382.      This is like the shell command `ln -s FILENAME NEWNAME'.
  383.  
  384.      In an interactive call, FILENAME and NEWNAME are read in the
  385.      minibuffer, and OK-IF-EXISTS is set to the numeric prefix argument.
  386.  
  387.  - Function: define-logical-name VARNAME STRING
  388.      This function defines the logical name NAME to have the value
  389.      STRING.  It is available only on VMS.
  390.  
  391.  - Function: set-file-modes FILENAME MODE
  392.      This function sets mode bits of FILENAME to MODE (which must be an
  393.      integer).  Only the 12 low bits of MODE are used.
  394.  
  395.  - Function: set-default-file-modes MODE
  396.      This function sets the default file protection for new files
  397.      created by Emacs and its subprocesses.  Every file created with
  398.      Emacs initially has this protection.  On Unix, the default
  399.      protection is the bitwise complement of the "umask" value.
  400.  
  401.      The argument MODE must be an integer.  Only the 9 low bits of MODE
  402.      are used.
  403.  
  404.      Saving a modified version of an existing file does not count as
  405.      creating the file; it does not change the file's mode, and does
  406.      not use the default file protection.
  407.  
  408.  - Function: default-file-modes
  409.      This function returns the current default protection value.
  410.  
  411. 
  412. File: elisp,  Node: File Names,  Next: Magic File Names,  Prev: Changing File Attributes,  Up: Files
  413.  
  414. File Names
  415. ==========
  416.  
  417.    Files are generally referred to by their names, in Emacs as
  418. elsewhere.  File names in Emacs are represented as strings.  The
  419. functions that operate on a file all expect a file name argument.
  420.  
  421.    In addition to operating on files themselves, Emacs Lisp programs
  422. often need to operate on the names; i.e., to take them apart and to use
  423. part of a name to construct related file names.  This section describes
  424. how to manipulate file names.
  425.  
  426.    The functions in this section do not actually access files, so they
  427. can operate on file names that do not refer to an existing file or
  428. directory.
  429.  
  430.    On VMS, all these functions understand both VMS file name syntax and
  431. Unix syntax.  This is so that all the standard Lisp libraries can
  432. specify file names in Unix syntax and work properly on VMS without
  433. change.
  434.  
  435. * Menu:
  436.  
  437. * File Name Components::  The directory part of a file name, and the rest.
  438. * Directory Names::       A directory's name as a directory
  439.                             is different from its name as a file.
  440. * Relative File Names::   Some file names are relative to a current directory.
  441. * File Name Expansion::   Converting relative file names to absolute ones.
  442. * Unique File Names::     Generating names for temporary files.
  443. * File Name Completion::  Finding the completions for a given file name.
  444.  
  445. 
  446. File: elisp,  Node: File Name Components,  Next: Directory Names,  Up: File Names
  447.  
  448. File Name Components
  449. --------------------
  450.  
  451.    The operating system groups files into directories.  To specify a
  452. file, you must specify the directory, and the file's name in that
  453. directory.  Therefore, a file name in Emacs is considered to have two
  454. main parts: the "directory name" part, and the "nondirectory" part (or
  455. "file name within the directory").  Either part may be empty.
  456. Concatenating these two parts reproduces the original file name.
  457.  
  458.    On Unix, the directory part is everything up to and including the
  459. last slash; the nondirectory part is the rest.  The rules in VMS syntax
  460. are complicated.
  461.  
  462.    For some purposes, the nondirectory part is further subdivided into
  463. the name proper and the "version number".  On Unix, only backup files
  464. have version numbers in their names; on VMS, every file has a version
  465. number, but most of the time the file name actually used in Emacs omits
  466. the version number.  Version numbers are found mostly in directory
  467. lists.
  468.  
  469.  - Function: file-name-directory FILENAME
  470.      This function returns the directory part of FILENAME (or `nil' if
  471.      FILENAME does not include a directory part).  On Unix, the
  472.      function returns a string ending in a slash.  On VMS, it returns a
  473.      string ending in one of the three characters `:', `]', or `>'.
  474.  
  475.           (file-name-directory "lewis/foo")  ; Unix example
  476.                => "lewis/"
  477.           (file-name-directory "foo")        ; Unix example
  478.                => nil
  479.           (file-name-directory "[X]FOO.TMP") ; VMS example
  480.                => "[X]"
  481.  
  482.  - Function: file-name-nondirectory FILENAME
  483.      This function returns the nondirectory part of FILENAME.
  484.  
  485.           (file-name-nondirectory "lewis/foo")
  486.                => "foo"
  487.           (file-name-nondirectory "foo")
  488.                => "foo"
  489.           ;; The following example is accurate only on VMS.
  490.           (file-name-nondirectory "[X]FOO.TMP")
  491.                => "FOO.TMP"
  492.  
  493.  - Function: file-name-sans-versions FILENAME
  494.      This function returns FILENAME without any file version numbers,
  495.      backup version numbers, or trailing tildes.
  496.  
  497.           (file-name-sans-versions "~rms/foo.~1~")
  498.                => "~rms/foo"
  499.           (file-name-sans-versions "~rms/foo~")
  500.                => "~rms/foo"
  501.           (file-name-sans-versions "~rms/foo")
  502.                => "~rms/foo"
  503.           ;; The following example applies to VMS only.
  504.           (file-name-sans-versions "foo;23")
  505.                => "foo"
  506.  
  507. 
  508. File: elisp,  Node: Directory Names,  Next: Relative File Names,  Prev: File Name Components,  Up: File Names
  509.  
  510. Directory Names
  511. ---------------
  512.  
  513.    A "directory name" is the name of a directory.  A directory is a
  514. kind of file, and it has a file name, which is related to the directory
  515. name but not identical to it.  (This is not quite the same as the usual
  516. Unix terminology.)  These two different names for the same entity are
  517. related by a syntactic transformation.  On Unix, this is simple: a
  518. directory name ends in a slash, whereas the directory's name as a file
  519. lacks that slash.  On VMS, the relationship is more complicated.
  520.  
  521.    The difference between a directory name and its name as a file is
  522. subtle but crucial.  When an Emacs variable or function argument is
  523. described as being a directory name, a file name of a directory is not
  524. acceptable.
  525.  
  526.    These two functions take a single argument, FILENAME, which must be
  527. a string.  Environment variable substitutions such as `$HOME', and the
  528. symbols `~', and `..', are *not* expanded.  Use `expand-file-name' or
  529. `substitute-in-file-name' for that (*note File Name Expansion::.).
  530.  
  531.  - Function: file-name-as-directory FILENAME
  532.      This function returns a string representing FILENAME in a form
  533.      that the operating system will interpret as the name of a
  534.      directory.  In Unix, this means that a slash is appended to the
  535.      string.  On VMS, the function converts a string of the form
  536.      `[X]Y.DIR.1' to the form `[X.Y]'.
  537.  
  538.           (file-name-as-directory "~rms/lewis")
  539.                => "~rms/lewis/"
  540.  
  541.  - Function: directory-file-name DIRNAME
  542.      This function returns a string representing DIRNAME in a form that
  543.      the operating system will interpret as the name of a file.  On
  544.      Unix, this means removing a final slash from the string.  On VMS,
  545.      the function converts a string of the form `[X.Y]' to `[X]Y.DIR.1'.
  546.  
  547.           (directory-file-name "~lewis/")
  548.                => "~lewis"
  549.  
  550.    Directory name abbreviations are useful for directories that are
  551. normally accessed through symbolic links.  Sometimes the users recognize
  552. primarily the link's name as "the name" of the directory, and find it
  553. annoying to see the directory's "real" name.  If you define the link
  554. name as an abbreviation for the "real" name, Emacs shows users the
  555. abbreviation instead.
  556.  
  557.    If you wish to convert a directory name to its abbreviation, use this
  558. function:
  559.  
  560.  - Function: abbreviate-file-name DIRNAME
  561.      This function applies abbreviations from `directory-abbrev-alist'
  562.      to its argument, and substitutes `~' for the user's home directory.
  563.  
  564.  - Variable: directory-abbrev-alist
  565.      The variable `directory-abbrev-alist' contains an alist of
  566.      abbreviations to use for file directories.  Each element has the
  567.      form `(FROM . TO)', and says to replace FROM with TO when it
  568.      appears in a directory name.  The FROM string is actually a
  569.      regular expression; it should always start with `^'.  The function
  570.      `abbreviate-file-name' performs these substitutions.
  571.  
  572.      You can set this variable in `site-init.el' to describe the
  573.      abbreviations appropriate for your site.
  574.  
  575.      Here's an example, from a system on which file system `/home/fsf'
  576.      and so on are normally accessed through symbolic links named `/fsf'
  577.      and so on.
  578.  
  579.           (("^/home/fsf" . "/fsf")
  580.            ("^/home/gp" . "/gp")
  581.            ("^/home/gd" . "/gd"))
  582.  
  583. 
  584. File: elisp,  Node: Relative File Names,  Next: File Name Expansion,  Prev: Directory Names,  Up: File Names
  585.  
  586. Absolute and Relative File Names
  587. --------------------------------
  588.  
  589.    All the directories in the file system form a tree starting at the
  590. root directory.  A file name can specify all the directory names
  591. starting from the root of the tree; then it is called an "absolute"
  592. file name.  Or it can specify the position of the file in the tree
  593. relative to a default directory; then it is called an "relative" file
  594. name.  On Unix, an absolute file name starts with a slash or a tilde
  595. (`~'), and a relative one does not.  The rules on VMS are complicated.
  596.  
  597.  - Function: file-name-absolute-p FILENAME
  598.      This function returns `t' if file FILENAME is an absolute file
  599.      name, `nil' otherwise.  On VMS, this function understands both
  600.      Unix syntax and VMS syntax.
  601.  
  602.           (file-name-absolute-p "~rms/foo")
  603.                => t
  604.           (file-name-absolute-p "rms/foo")
  605.                => nil
  606.           (file-name-absolute-p "/user/rms/foo")
  607.                => t
  608.  
  609. 
  610. File: elisp,  Node: File Name Expansion,  Next: Unique File Names,  Prev: Relative File Names,  Up: File Names
  611.  
  612. Functions that Expand Filenames
  613. -------------------------------
  614.  
  615.    "Expansion" of a file name means converting a relative file name to
  616. an absolute one.  Since this is done relative to a default directory,
  617. you must specify the default directory name as well as the file name to
  618. be expanded.  Expansion also simplifies file names by eliminating
  619. redundancies such as `./' and `NAME/../'.
  620.  
  621.  - Function: expand-file-name FILENAME &optional DIRECTORY
  622.      This function converts FILENAME to an absolute file name.  If
  623.      DIRECTORY is supplied, it is the directory to start with if
  624.      FILENAME is relative.  (The value of DIRECTORY should itself be an
  625.      absolute, expanded file name; it should not start with `~'.)
  626.      Otherwise, the current buffer's value of `default-directory' is
  627.      used.  For example:
  628.  
  629.           (expand-file-name "foo")
  630.                => "/xcssun/users/rms/lewis/foo"
  631.           (expand-file-name "../foo")
  632.                => "/xcssun/users/rms/foo"
  633.           (expand-file-name "foo" "/usr/spool/")
  634.                => "/usr/spool/foo"
  635.           (expand-file-name "$HOME/foo")
  636.                => "/xcssun/users/rms/lewis/$HOME/foo"
  637.  
  638.      Filenames containing `.' or `..' are simplified to their canonical
  639.      form:
  640.  
  641.           (expand-file-name "bar/../foo")
  642.                => "/xcssun/users/rms/lewis/foo"
  643.  
  644.      `~/' is expanded into the user's home directory.  A `/' or `~'
  645.      following a `/' is taken to be the start of an absolute file name
  646.      that overrides what precedes it, so everything before that `/' or
  647.      `~' is deleted.  For example:
  648.  
  649.           (expand-file-name
  650.            "/a1/gnu//usr/local/lib/emacs/etc/MACHINES")
  651.                => "/usr/local/lib/emacs/etc/MACHINES"
  652.           (expand-file-name "/a1/gnu/~/foo")
  653.                => "/xcssun/users/rms/foo"
  654.  
  655.      In both cases, `/a1/gnu/' is discarded because an absolute file
  656.      name follows it.
  657.  
  658.      Note that `expand-file-name' does *not* expand environment
  659.      variables; that is done only by `substitute-in-file-name'.
  660.  
  661.  - Function: file-relative-name FILENAME DIRECTORY
  662.      This function does the inverse of expansion--it tries to return a
  663.      relative name which is equivalent to FILENAME when interpreted
  664.      relative to DIRECTORY.  (If such a relative name would be longer
  665.      than the absolute name, it returns the absolute name instead.)
  666.  
  667.           (file-relative-name "/foo/bar" "/foo/")
  668.                => "bar")
  669.           (file-relative-name "/foo/bar" "/hack/")
  670.                => "/foo/bar")
  671.  
  672.  - Variable: default-directory
  673.      The value of this buffer-local variable is the default directory
  674.      for the current buffer.  It is local in every buffer.
  675.      `expand-file-name' uses the default directory when its second
  676.      argument is `nil'.
  677.  
  678.      On Unix systems, the value is always a string ending with a slash.
  679.  
  680.           default-directory
  681.                => "/user/lewis/manual/"
  682.  
  683.  - Function: substitute-in-file-name FILENAME
  684.      This function replaces environment variables names in FILENAME
  685.      with the values to which they are set by the operating system.
  686.      Following standard Unix shell syntax, `$' is the prefix to
  687.      substitute an environment variable value.
  688.  
  689.      The environment variable name is the series of alphanumeric
  690.      characters (including underscores) that follow the `$'.  If the
  691.      character following the `$' is a `{', then the variable name is
  692.      everything up to the matching `}'.
  693.  
  694.      Here we assume that the environment variable `HOME', which holds
  695.      the user's home directory name, has value `/xcssun/users/rms'.
  696.  
  697.           (substitute-in-file-name "$HOME/foo")
  698.                => "/xcssun/users/rms/foo"
  699.  
  700.      If a `~' or a `/' appears following a `/', after substitution,
  701.      everything before the following `/' is discarded:
  702.  
  703.           (substitute-in-file-name "bar/~/foo")
  704.                => "~/foo"
  705.           (substitute-in-file-name "/usr/local/$HOME/foo")
  706.                => "/xcssun/users/rms/foo"
  707.  
  708.      On VMS, `$' substitution is not done, so this function does nothing
  709.      on VMS except discard superfluous initial components as shown
  710.      above.
  711.  
  712. 
  713. File: elisp,  Node: Unique File Names,  Next: File Name Completion,  Prev: File Name Expansion,  Up: File Names
  714.  
  715. Generating Unique File Names
  716. ----------------------------
  717.  
  718.    Some programs need to write temporary files.  Here is the usual way
  719. to construct a name for such a file:
  720.  
  721.      (make-temp-name (concat "/tmp/" NAME-OF-APPLICATION))
  722.  
  723. Here we use the directory `/tmp/' because that is the standard place on
  724. Unix for temporary files.  The job of `make-temp-name' is to prevent
  725. two different users or two different jobs from trying to use the same
  726. name.
  727.  
  728.  - Function: make-temp-name STRING
  729.      This function generates string that can be used as a unique name.
  730.      The name starts with the prefix STRING, and ends with a number that
  731.      is different in each Emacs job.
  732.  
  733.           (make-temp-name "/tmp/foo")
  734.                => "/tmp/foo021304"
  735.  
  736.      To prevent conflicts among different application libraries run in
  737.      the same Emacs, each application should have its own STRING.  The
  738.      number added to the end of the name distinguishes between the same
  739.      application running in different Emacs jobs.
  740.  
  741. 
  742. File: elisp,  Node: File Name Completion,  Prev: Unique File Names,  Up: File Names
  743.  
  744. File Name Completion
  745. --------------------
  746.  
  747.    This section describes low-level subroutines for completing a file
  748. name.  For other completion functions, see *Note Completion::.
  749.  
  750.  - Function: file-name-all-completions PARTIAL-FILENAME DIRECTORY
  751.      This function returns a list of all possible completions for a file
  752.      whose name starts with PARTIAL-FILENAME in directory DIRECTORY.
  753.      The order of the completions is the order of the files in the
  754.      directory, which is unpredictable and conveys no useful
  755.      information.
  756.  
  757.      The argument PARTIAL-FILENAME must be a file name containing no
  758.      directory part and no slash.  The current buffer's default
  759.      directory is prepended to DIRECTORY, if DIRECTORY is not an
  760.      absolute file name.
  761.  
  762.      In the following example, suppose that the current default
  763.      directory, `~rms/lewis', has five files whose names begin with `f':
  764.      `foo', `file~', `file.c', `file.c.~1~', and `file.c.~2~'.
  765.  
  766.           (file-name-all-completions "f" "")
  767.                => ("foo" "file~" "file.c.~2~"
  768.                           "file.c.~1~" "file.c")
  769.           
  770.           (file-name-all-completions "fo" "")
  771.                => ("foo")
  772.  
  773.  - Function: file-name-completion FILENAME DIRECTORY
  774.      This function completes the file name FILENAME in directory
  775.      DIRECTORY.  It returns the longest prefix common to all file names
  776.      in directory DIRECTORY that start with FILENAME.
  777.  
  778.      If only one match exists and FILENAME matches it exactly, the
  779.      function returns `t'.  The function returns `nil' if directory
  780.      DIRECTORY contains no name starting with FILENAME.
  781.  
  782.      In the following example, suppose that the current default
  783.      directory has five files whose names begin with `f': `foo',
  784.      `file~', `file.c', `file.c.~1~', and `file.c.~2~'.
  785.  
  786.           (file-name-completion "fi" "")
  787.                => "file"
  788.           
  789.           (file-name-completion "file.c.~1" "")
  790.                => "file.c.~1~"
  791.           
  792.           (file-name-completion "file.c.~1~" "")
  793.                => t
  794.           
  795.           (file-name-completion "file.c.~3" "")
  796.                => nil
  797.  
  798.  - User Option: completion-ignored-extensions
  799.      `file-name-completion' usually ignores file names that end in any
  800.      string in this list.  It does not ignore them when all the possible
  801.      completions end in one of these suffixes or when a buffer showing
  802.      all possible completions is displayed.
  803.  
  804.      A typical value might look like this:
  805.  
  806.           completion-ignored-extensions
  807.                => (".o" ".elc" "~" ".dvi")
  808.  
  809. 
  810. File: elisp,  Node: Magic File Names,  Prev: File Names,  Up: Files
  811.  
  812. Making Certain File Names "Magic"
  813. =================================
  814.  
  815.    You can implement special handling for certain file names.  This is
  816. called making those names "magic".  You must supply a regular
  817. expression to define the class of names (all those which match the
  818. regular expression), plus a handler that implements all the primitive
  819. Emacs file operations for file names that do match.
  820.  
  821.    The value of `file-name-handler-alist' is a list of handlers,
  822. together with regular expressions that decide when to apply each
  823. handler.  Each element has this form:
  824.  
  825.      (REGEXP . HANDLER)
  826.  
  827. All the Emacs primitives for file access and file name transformation
  828. check the given file name against `file-name-handler-alist'.  If the
  829. file name matches REGEXP, the primitives handle that file by calling
  830. HANDLER.
  831.  
  832.    The first argument given to HANDLER is the name of the primitive;
  833. the remaining arguments are the arguments that were passed to that
  834. operation.  (The first of these arguments is typically the file name
  835. itself.)  For example, if you do this:
  836.  
  837.      (file-exists-p FILENAME)
  838.  
  839. and FILENAME has handler HANDLER, then HANDLER is called like this:
  840.  
  841.      (funcall HANDLER 'file-exists-p FILENAME)
  842.  
  843.    Here are the operations that you can handle for a magic file name:
  844.  
  845. `add-name-to-file', `copy-file', `delete-directory',
  846. `delete-file', `directory-file-name', `directory-files',
  847. `dired-compress-file', `dired-uncache',
  848. `expand-file-name', `file-accessible-directory-p',
  849. `file-attributes', `file-directory-p',
  850. `file-executable-p', `file-exists-p', `file-local-copy',
  851. `file-modes', `file-name-all-completions',
  852. `file-name-as-directory', `file-name-completion',
  853. `file-name-directory', `file-name-nondirectory',
  854. `file-name-sans-versions', `file-newer-than-file-p',
  855. `file-readable-p', `file-symlink-p', `file-writable-p',
  856. `insert-directory', `insert-file-contents', `load',
  857. `make-directory', `make-symbolic-link', `rename-file',
  858. `set-file-modes', `set-visited-file-modtime',
  859. `unhandled-file-name-directory',
  860. `verify-visited-file-modtime', `write-region'.
  861.  
  862.    The handler function must handle all of the above operations, and
  863. possibly others to be added in the future.  Therefore, it should always
  864. reinvoke the ordinary Lisp primitive when it receives an operation it
  865. does not recognize.  Here's one way to do this:
  866.  
  867.      (defun my-file-handler (operation &rest args)
  868.        ;; First check for the specific operations
  869.        ;; that we have special handling for.
  870.        (cond ((eq operation 'insert-file-contents) ...)
  871.              ((eq operation 'write-region) ...)
  872.              ...
  873.              ;; Handle any operation we don't know about.
  874.              (t (let (file-name-handler-alist)
  875.                   (apply operation args)))))
  876.  
  877.  - Function: find-file-name-handler FILE
  878.      This function returns the handler function for file name FILE, or
  879.      `nil' if there is none.
  880.  
  881.  - Function: file-local-copy FILENAME
  882.      This function copies file FILENAME to the local site, if it isn't
  883.      there already.  If FILENAME specifies a "magic" file name which
  884.      programs outside Emacs cannot directly read or write, this copies
  885.      the contents to an ordinary file and returns that file's name.
  886.  
  887.      If FILENAME is an ordinary file name, not magic, then this function
  888.      does nothing and returns `nil'.
  889.  
  890.  - Function: unhandled-file-name-directory FILENAME
  891.      This function returns the name of a directory that is not magic.
  892.      It uses the directory part of FILENAME if that is not magic.
  893.      Otherwise, it asks the handler what to do.
  894.  
  895.      This is used for running a subprocess; any subprocess must have a
  896.      non-magic directory to serve as its current directory.
  897.  
  898. 
  899. File: elisp,  Node: Backups and Auto-Saving,  Next: Buffers,  Prev: Files,  Up: Top
  900.  
  901. Backups and Auto-Saving
  902. ***********************
  903.  
  904.    Backup files and auto-save files are two methods by which Emacs tries
  905. to protect the user from the consequences of crashes or of the user's
  906. own errors.  Auto-saving preserves the text from earlier in the current
  907. editing session; backup files preserve file contents prior to the
  908. current session.
  909.  
  910. * Menu:
  911.  
  912. * Backup Files::   How backup files are made; how their names are chosen.
  913. * Auto-Saving::    How auto-save files are made; how their names are chosen.
  914. * Reverting::      `revert-buffer', and how to customize what it does.
  915.  
  916. 
  917. File: elisp,  Node: Backup Files,  Next: Auto-Saving,  Prev: Backups and Auto-Saving,  Up: Backups and Auto-Saving
  918.  
  919. Backup Files
  920. ============
  921.  
  922.    A "backup file" is a copy of the old contents of a file you are
  923. editing.  Emacs makes a backup file the first time you save a buffer
  924. into its visited file.  Normally, this means that the backup file
  925. contains the contents of the file as it was before the current editing
  926. session.  The contents of the backup file normally remain unchanged once
  927. it exists.
  928.  
  929.    Backups are usually made by renaming the visited file to a new name.
  930. Optionally, you can specify that backup files should be made by copying
  931. the visited file.  This choice makes a difference for files with
  932. multiple names; it also can affect whether the edited file remains owned
  933. by the original owner or becomes owned by the user editing it.
  934.  
  935.    By default, Emacs makes a single backup file for each file edited.
  936. You can alternatively request numbered backups; then each new backup
  937. file gets a new name.  You can delete old numbered backups when you
  938. don't want them any more, or Emacs can delete them automatically.
  939.  
  940. * Menu:
  941.  
  942. * Making Backups::     How Emacs makes backup files, and when.
  943. * Rename or Copy::     Two alternatives: renaming the old file or copying it.
  944. * Numbered Backups::   Keeping multiple backups for each source file.
  945. * Backup Names::       How backup file names are computed; customization.
  946.  
  947. 
  948. File: elisp,  Node: Making Backups,  Next: Rename or Copy,  Prev: Backup Files,  Up: Backup Files
  949.  
  950. Making Backup Files
  951. -------------------
  952.  
  953.  - Function: backup-buffer
  954.      This function makes a backup of the file visited by the current
  955.      buffer, if appropriate.  It is called by `save-buffer' before
  956.      saving the buffer the first time.
  957.  
  958.  - Variable: buffer-backed-up
  959.      This buffer-local variable indicates whether this buffer's file has
  960.      been backed up on account of this buffer.  If it is non-`nil', then
  961.      the backup file has been written.  Otherwise, the file should be
  962.      backed up when it is next saved (if backup files are enabled).
  963.      This is a permanent local; `kill-local-variables' does not alter
  964.      it.
  965.  
  966.  - User Option: make-backup-files
  967.      This variable determines whether or not to make backup files.  If
  968.      it is non-`nil', then Emacs creates a backup of each file when it
  969.      is saved for the first time.
  970.  
  971.      The following example shows how to change the `make-backup-files'
  972.      variable only in the `RMAIL' buffer and not elsewhere.  Setting it
  973.      `nil' stops Emacs from making backups of the `RMAIL' file, which
  974.      may save disk space.  (You would put this code in your `.emacs'
  975.      file.)
  976.  
  977.           (add-hook 'rmail-mode-hook
  978.                     (function (lambda ()
  979.                                 (make-local-variable
  980.                                  'make-backup-files)
  981.                                 (setq make-backup-files nil))))
  982.  
  983.  - Variable: backup-enable-predicate
  984.      This variable's value is a function to be called on certain
  985.      occasions to decide whether a there should be backup files for
  986.      file name FILENAME.  If it returns `nil', backups are disabled.
  987.      Otherwise, backups are enabled (if `make-backup-files' is true).
  988.  
  989. 
  990. File: elisp,  Node: Rename or Copy,  Next: Numbered Backups,  Prev: Making Backups,  Up: Backup Files
  991.  
  992. Backup by Renaming or by Copying?
  993. ---------------------------------
  994.  
  995.    There are two ways that Emacs can make a backup file:
  996.  
  997.    * Emacs can rename the original file so that it becomes a backup
  998.      file, and then write the buffer being saved into a new file.
  999.      After this procedure, any other names (i.e., hard links) of the
  1000.      original file now refer to the backup file.  The new file is owned
  1001.      by the user doing the editing, and its group is the default for
  1002.      new files written by the user in that directory.
  1003.  
  1004.    * Emacs can copy the original file into a backup file, and then
  1005.      overwrite the original file with new contents.  After this
  1006.      procedure, any other names (i.e., hard links) of the original file
  1007.      still refer to the current version of the file.  The file's owner
  1008.      and group will be unchanged.
  1009.  
  1010.    The first method, renaming, is the default.
  1011.  
  1012.    The variable `backup-by-copying', if non-`nil', says to use the
  1013. second method, which is to copy the original file and overwrite it with
  1014. the new buffer contents.  The variable `file-precious-flag', if
  1015. non-`nil', also has this effect (as a sideline of its main
  1016. significance).  *Note Saving Buffers::.
  1017.  
  1018.    The following two variables, when non-`nil', cause the second method
  1019. to be used in certain special cases.  They have no effect on the
  1020. treatment of files that don't fall into the special cases.
  1021.  
  1022.  - Variable: backup-by-copying
  1023.      This variable controls whether to make backup files by copying.
  1024.      If it is non-`nil', then Emacs always copies the current contents
  1025.      of the file into the backup file before writing the buffer to be
  1026.      saved to the file.  (In many circumstances, this has the same
  1027.      effect as `file-precious-flag'.)
  1028.  
  1029.  - Variable: backup-by-copying-when-linked
  1030.      This variable controls whether to make backups by copying for files
  1031.      with multiple names (hard links).  If it is non-`nil', then Emacs
  1032.      uses copying to create backups for those files.
  1033.  
  1034.      This variable is significant only if `backup-by-copying' is `nil',
  1035.      since copying is always used when that variable is non-`nil'.
  1036.  
  1037.  - Variable: backup-by-copying-when-mismatch
  1038.      This variable controls whether to make backups by copying in cases
  1039.      where renaming would change either the owner or the group of the
  1040.      file.  If it is non-`nil' then Emacs creates backups by copying in
  1041.      such cases.
  1042.  
  1043.      The value has no effect when renaming would not alter the owner or
  1044.      group of the file; that is, for files which are owned by the user
  1045.      and whose group matches the default for a new file created there
  1046.      by the user.
  1047.  
  1048.      This variable is significant only if `backup-by-copying' is `nil',
  1049.      since copying is always used when that variable is non-`nil'.
  1050.  
  1051. 
  1052. File: elisp,  Node: Numbered Backups,  Next: Backup Names,  Prev: Rename or Copy,  Up: Backup Files
  1053.  
  1054. Making and Deleting Numbered Backup Files
  1055. -----------------------------------------
  1056.  
  1057.    If a file's name is `foo', the names of its numbered backup versions
  1058. are `foo.~V~', for various integers V, like this: `foo.~1~', `foo.~2~',
  1059. `foo.~3~', ..., `foo.~259~', and so on.
  1060.  
  1061.  - User Option: version-control
  1062.      This variable controls whether to make a single non-numbered backup
  1063.      file or multiple numbered backups.
  1064.  
  1065.     `nil'
  1066.           Make numbered backups if the visited file already has
  1067.           numbered backups; otherwise, do not.
  1068.  
  1069.     `never'
  1070.           Do not make numbered backups.
  1071.  
  1072.     ANYTHING ELSE
  1073.           Do make numbered backups.
  1074.  
  1075.    The use of numbered backups ultimately leads to a large number of
  1076. backup versions, which must then be deleted.  Emacs can do this
  1077. automatically.
  1078.  
  1079.  - User Option: kept-new-versions
  1080.      The value of this variable is the number of oldest versions to keep
  1081.      when a new numbered backup is made.  The newly made backup is
  1082.      included in the count.  The default value is 2.
  1083.  
  1084.  - User Option: kept-old-versions
  1085.      The value of this variable is the number of oldest versions to keep
  1086.      when a new numbered backup is made.  The default value is 2.
  1087.  
  1088.  - User Option: dired-kept-versions
  1089.      This variable plays a role in Dired's `dired-clean-directory'
  1090.      (`.') command like that played by `kept-old-versions' when a
  1091.      backup file is made.  The default value is 2.
  1092.  
  1093.    If there are backups numbered 1, 2, 3, 5, and 7, and both of these
  1094. variables have the value 2, then the backups numbered 1 and 2 are kept
  1095. as old versions and those numbered 5 and 7 are kept as new versions;
  1096. backup version 3 is deleted.  The function `find-backup-file-name'
  1097. (*note Backup Names::.) is responsible for determining which backup
  1098. versions to delete, but does not delete them itself.
  1099.  
  1100.  - User Option: trim-versions-without-asking
  1101.      If this variable is non-`nil', then saving a file deletes excess
  1102.      backup versions silently.  Otherwise, it asks the user whether to
  1103.      delete them.
  1104.  
  1105. 
  1106. File: elisp,  Node: Backup Names,  Prev: Numbered Backups,  Up: Backup Files
  1107.  
  1108. Naming Backup Files
  1109. -------------------
  1110.  
  1111.    The functions in this section are documented mainly because you can
  1112. customize the naming conventions for backup files by redefining them.
  1113. If you change one, you probably need to change the rest.
  1114.  
  1115.  - Function: backup-file-name-p FILENAME
  1116.      This function returns a non-`nil' value if FILENAME is a possible
  1117.      name for a backup file.  A file with the name FILENAME need not
  1118.      exist; the function just checks the name.
  1119.  
  1120.           (backup-file-name-p "foo")
  1121.                => nil
  1122.  
  1123.           (backup-file-name-p "foo~")
  1124.                => 3
  1125.  
  1126.      The standard definition of this function is as follows:
  1127.  
  1128.           (defun backup-file-name-p (file)
  1129.             "Return non-nil if FILE is a backup file \
  1130.           name (numeric or not)..."
  1131.             (string-match "~$" file))
  1132.  
  1133.      Thus, the function returns a non-`nil' value if the file name ends
  1134.      with a `~'.  (We use a backslash to split the documentation
  1135.      string's first line into two lines in the text, but produce just
  1136.      one line in the string itself.)
  1137.  
  1138.      This simple expression is placed in a separate function to make it
  1139.      easy to redefine for customization.
  1140.  
  1141.  - Function: make-backup-file-name FILENAME
  1142.      This function returns a string which is the name to use for a
  1143.      non-numbered backup file for file FILENAME.  On Unix, this is just
  1144.      FILENAME with a tilde appended.
  1145.  
  1146.      The standard definition of this function is as follows:
  1147.  
  1148.           (defun make-backup-file-name (file)
  1149.             "Create the non-numeric backup file name for FILE..."
  1150.             (concat file "~"))
  1151.  
  1152.      You can change the backup file naming convention by redefining this
  1153.      function.  In the following example, `make-backup-file-name' is
  1154.      redefined to prepend a `.' as well as to append a tilde.
  1155.  
  1156.           (defun make-backup-file-name (filename)
  1157.             (concat "." filename "~"))
  1158.  
  1159.           (make-backup-file-name "backups.texi")
  1160.                => ".backups.texi~"
  1161.  
  1162.  - Function: find-backup-file-name FILENAME
  1163.      This function computes the file name for a new backup file for
  1164.      FILENAME.  It may also propose certain existing backup files for
  1165.      deletion.  `find-backup-file-name' returns a list whose CAR is the
  1166.      name for the new backup file and whose CDR is a list of backup
  1167.      files whose deletion is proposed.
  1168.  
  1169.      Two variables, `kept-old-versions' and `kept-new-versions',
  1170.      determine which old backup versions should be kept (by excluding
  1171.      them from the list of backup files ripe for deletion).  *Note
  1172.      Numbered Backups::.
  1173.  
  1174.      In this example, the value says that `~rms/foo.~5~' is the name to
  1175.      use for the new backup file, and `~rms/foo.~3~' is an "excess"
  1176.      version that the caller should consider deleting now.
  1177.  
  1178.           (find-backup-file-name "~rms/foo")
  1179.                => ("~rms/foo.~5~" "~rms/foo.~3~")
  1180.  
  1181.  - Function: file-newest-backup FILENAME
  1182.      This function returns the name of the most recent backup file for
  1183.      FILENAME, or `nil' that file has no backup files.
  1184.  
  1185.      Some file comparison commands use this function in order to compare
  1186.      a file by default with its most recent backup.
  1187.  
  1188.