1843 |
(setq tail (cdr tail))) |
(setq tail (cdr tail))) |
1844 |
alist)) |
alist)) |
1845 |
|
|
1846 |
(defun make-temp-file (prefix &optional dir-flag) |
(defun make-temp-file (prefix &optional dir-flag suffix) |
1847 |
"Create a temporary file. |
"Create a temporary file. |
1848 |
The returned file name (created by appending some random characters at the end |
The returned file name (created by appending some random characters at the end |
1849 |
of PREFIX, and expanding against `temporary-file-directory' if necessary, |
of PREFIX, and expanding against `temporary-file-directory' if necessary, |
1850 |
is guaranteed to point to a newly created empty file. |
is guaranteed to point to a newly created empty file. |
1851 |
You can then use `write-region' to write new data into the file. |
You can then use `write-region' to write new data into the file. |
1852 |
|
|
1853 |
If DIR-FLAG is non-nil, create a new empty directory instead of a file." |
If DIR-FLAG is non-nil, create a new empty directory instead of a file. |
1854 |
|
|
1855 |
|
If SUFFIX is non-nil, add that at the end of the file name." |
1856 |
(let (file) |
(let (file) |
1857 |
(while (condition-case () |
(while (condition-case () |
1858 |
(progn |
(progn |
1859 |
(setq file |
(setq file |
1860 |
(make-temp-name |
(make-temp-name |
1861 |
(expand-file-name prefix temporary-file-directory))) |
(expand-file-name prefix temporary-file-directory))) |
1862 |
|
(if suffix |
1863 |
|
(setq file (concat file suffix))) |
1864 |
(if dir-flag |
(if dir-flag |
1865 |
(make-directory file) |
(make-directory file) |
1866 |
(write-region "" nil file nil 'silent nil 'excl)) |
(write-region "" nil file nil 'silent nil 'excl)) |