make-temp-file.
* mm-util.el (mm-make-temp-file): New function.
* nneething.el (nneething-file-name): Use it.
* mm-decode.el (mm-display-external, mm-create-image-xemacs): Ditto.
* gnus-uu.el (gnus-uu-decode-binhex, gnus-uu-decode-binhex-view)
(gnus-uu-digest-mail-forward, gnus-uu-initialize): Ditto.
* gnus-start.el (gnus-slave-save-newsrc): Ditto.
* message.el (message-mode): If buffer-file-name, don't set auto
save file name.
Trivial change from Geoff Greene <ggreene@wpi.edu>
-2002-03-05 ShengHuo ZHU <zsh@cs.rochester.edu>
+2002-03-21 ShengHuo ZHU <zsh@cs.rochester.edu>
+
+ * mail-source.el (make-source-make-complex-temp-name): Use
+ make-temp-file.
+
+ * mm-util.el (mm-make-temp-file): New function.
+ * nneething.el (nneething-file-name): Use it.
+ * mm-decode.el (mm-display-external, mm-create-image-xemacs): Ditto.
+ * gnus-uu.el (gnus-uu-decode-binhex, gnus-uu-decode-binhex-view)
+ (gnus-uu-digest-mail-forward, gnus-uu-initialize): Ditto.
+ * gnus-start.el (gnus-slave-save-newsrc): Ditto.
+
+ * message.el (message-mode): If buffer-file-name, don't set auto
+ save file name.
+ Trivial change from Geoff Greene <ggreene@wpi.edu>
+
+2002-03-05 Eli Zaretskii <eliz@is.elta.co.il>
* qp.el (quoted-printable-decode-region): Doc addition.
- From: Eli Zaretskii <eliz@is.elta.co.il>
2002-02-21 ShengHuo ZHU <zsh@cs.rochester.edu>
(save-excursion
(set-buffer gnus-dribble-buffer)
(let ((slave-name
- (make-temp-name (concat gnus-current-startup-file "-slave-")))
+ (mm-make-temp-file (concat gnus-current-startup-file "-slave-")))
(modes (ignore-errors
(file-modes (concat gnus-current-startup-file ".eld")))))
(let ((coding-system-for-write gnus-ding-file-coding-system))
gnus-uu-default-dir
gnus-uu-default-dir))))
(setq gnus-uu-binhex-article-name
- (make-temp-name (concat gnus-uu-work-dir "binhex")))
+ (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir)))
(gnus-uu-decode-with-method 'gnus-uu-binhex-article n dir))
(defun gnus-uu-decode-uu-view (&optional n)
(read-file-name "Unbinhex, view and save in dir: "
gnus-uu-default-dir gnus-uu-default-dir)))
(setq gnus-uu-binhex-article-name
- (make-temp-name (concat gnus-uu-work-dir "binhex")))
+ (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir)))
(let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
(gnus-uu-decode-binhex n file)))
"Digests and forwards all articles in this series."
(interactive "P")
(let ((gnus-uu-save-in-digest t)
- (file (make-temp-name (nnheader-concat gnus-uu-tmp-dir "forward")))
+ (file (mm-make-temp-file (nnheader-concat gnus-uu-tmp-dir "forward")))
(message-forward-as-mime message-forward-as-mime)
(mail-parse-charset gnus-newsgroup-charset)
(mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
gnus-uu-tmp-dir)))
(setq gnus-uu-work-dir
- (make-temp-name (concat gnus-uu-tmp-dir "gnus")))
- (gnus-make-directory gnus-uu-work-dir)
+ (mm-make-temp-file (concat gnus-uu-tmp-dir "gnus") 'dir))
(set-file-modes gnus-uu-work-dir 448)
(setq gnus-uu-work-dir (file-name-as-directory gnus-uu-work-dir))
(push (cons gnus-newsgroup-name gnus-uu-work-dir)
(error "Cannot get new mail"))
0))))))))
-(defun mail-source-make-complex-temp-name (prefix)
- (let ((newname (make-temp-name prefix))
- (newprefix prefix))
- (while (file-exists-p newname)
- (setq newprefix (concat newprefix "x"))
- (setq newname (make-temp-name newprefix)))
- newname))
+(eval-and-compile
+ (if (fboundp 'make-temp-file)
+ (defalias 'mail-source-make-complex-temp-name 'make-temp-file)
+ (defun mail-source-make-complex-temp-name (prefix)
+ (let ((newname (make-temp-name prefix))
+ (newprefix prefix))
+ (while (file-exists-p newname)
+ (setq newprefix (concat newprefix "x"))
+ (setq newname (make-temp-name newprefix)))
+ newname))))
(defun mail-source-callback (callback info)
"Call CALLBACK on the mail file, and then remove the mail file.
(if (fboundp 'mail-abbrevs-setup)
(mail-abbrevs-setup)
(mail-aliases-setup)))
- (message-set-auto-save-file-name)
+ (unless buffer-file-name
+ (message-set-auto-save-file-name))
(mm-enable-multibyte)
(make-local-variable 'indent-tabs-mode) ;Turn off tabs for indentation.
(setq indent-tabs-mode nil)
(mm-handle-set-undisplayer handle mm)))))
;; The function is a string to be executed.
(mm-insert-part handle)
- (let* ((dir (make-temp-name (expand-file-name "emm." mm-tmp-directory)))
+ (let* ((dir (mm-make-temp-file
+ (expand-file-name "emm." mm-tmp-directory) 'dir))
(filename (mail-content-type-get
(mm-handle-disposition handle) 'filename))
(mime-info (mailcap-mime-info
(copiousoutput (assoc "copiousoutput" mime-info))
file buffer)
;; We create a private sub-directory where we store our files.
- (make-directory dir)
(set-file-modes dir 448)
(if filename
(setq file (expand-file-name (file-name-nondirectory filename)
dir))
- (setq file (make-temp-name (expand-file-name "mm." dir))))
+ (setq file (mm-make-temp-file (expand-file-name "mm." dir))))
(let ((coding-system-for-write mm-binary-coding-system))
(write-region (point-min) (point-max) file nil 'nomesg))
(message "Viewing with %s" method)
;; (without a ton of work) is to write them
;; out to a file, and then create a file
;; specifier.
- (let ((file (make-temp-name
+ (let ((file (mm-make-temp-file
(expand-file-name "emm.xbm"
mm-tmp-directory))))
(unwind-protect
(push dir result))
(push path result))))
+;; It is not a MIME function, but some MIME functions use it.
+(defalias 'mm-make-temp-file
+ (if (fboundp 'make-temp-file)
+ 'make-temp-file
+ (lambda (prefix &optional dir-flag)
+ (let ((file (expand-file-name
+ (make-temp-name prefix)
+ (if (fboundp 'temp-directory)
+ (temp-directory)
+ temporary-file-directory))))
+ (if dir-flag
+ (make-directory file))
+ file))))
+
(provide 'mm-util)
;;; mm-util.el ends here
(if (numberp article)
(if (setq fname (cadr (assq article nneething-map)))
(expand-file-name fname dir)
- (make-temp-name (expand-file-name "nneething" dir)))
+ (mm-make-temp-file (expand-file-name "nneething" dir)))
(expand-file-name article dir))))
(provide 'nneething)