Commit 3efe5554 authored by ShengHuo ZHU's avatar ShengHuo ZHU

* 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>
parent 3ae1b884
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>
......
......@@ -2500,7 +2500,7 @@ If FORCE is non-nil, the .newsrc file is read."
(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))
......
......@@ -457,7 +457,7 @@ didn't work, and overwrite existing files. Otherwise, ask each time."
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)
......@@ -510,7 +510,7 @@ didn't work, and overwrite existing files. Otherwise, ask each time."
(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)))
......@@ -521,7 +521,7 @@ didn't work, and overwrite existing files. Otherwise, ask each time."
"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)
......@@ -1779,8 +1779,7 @@ Gnus might fail to display all of it.")
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)
......
......@@ -450,13 +450,16 @@ Return the number of files that were found."
(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.
......
......@@ -1546,7 +1546,8 @@ M-RET `message-newline-and-reformat' (break the line and reformat)."
(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)
......
......@@ -400,7 +400,8 @@ external if displayed external."
(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
......@@ -410,12 +411,11 @@ external if displayed external."
(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)
......@@ -799,7 +799,7 @@ external if displayed external."
;; (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
......
......@@ -723,6 +723,20 @@ If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers."
(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
......@@ -365,7 +365,7 @@ included.")
(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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment