(elisp)Unique File Names

Next: File Name Completion Prev: File Name Expansion Up: File Names

Generating Unique File Names

   Some programs need to write temporary files.  Here is the usual way
to construct a name for such a file:

     (make-temp-name (concat "/tmp/" NAME-OF-APPLICATION))

Here we use the directory `/tmp/' because that is the standard place on
Unix for temporary files.  The job of `make-temp-name' is to prevent
two different users or two different jobs from trying to use the same

 - Function: make-temp-name STRING
     This function generates string that can be used as a unique name.
     The name starts with the prefix STRING, and ends with a number that
     is different in each Emacs job.

          (make-temp-name "/tmp/foo")
               => "/tmp/foo021304"

     To prevent conflicts among different application libraries run in
     the same Emacs, each application should have its own STRING.  The
     number added to the end of the name distinguishes between the same
     application running in different Emacs jobs.

automatically generated by info2www