Function: make-temp-name

make-temp-name is a function defined in fileio.c.

Signature

(make-temp-name PREFIX)

Documentation

Generate temporary file name (string) starting with PREFIX (a string).

This function tries to choose a name that has no existing file. For this to work, PREFIX should be an absolute file name, and PREFIX and the returned string should both be non-magic.

There is a race condition between calling make-temp-name and later creating the file, which opens all kinds of security holes. For that reason, you should normally use make-temp-file instead.

Other relevant functions are documented in the file-name group.

View in manual

Probably introduced at or before Emacs version 21.1.

Shortdoc

;; file-name
(make-temp-name "/tmp/foo-")
    => "/tmp/foo-0G5eUv"

Source Code

// Defined in /usr/src/emacs/src/fileio.c
{
  return Fmake_temp_file_internal (prefix, make_fixnum (0),
				   empty_unibyte_string, Qnil);
}