changeset 44075:7782e54757bb

* 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>
author ShengHuo ZHU <zsh@cs.rochester.edu>
date Thu, 21 Mar 2002 19:11:23 +0000
parents e1637a1c9023
children 13f77e440e6e
files lisp/gnus/ChangeLog lisp/gnus/gnus-start.el lisp/gnus/gnus-uu.el lisp/gnus/mail-source.el lisp/gnus/message.el lisp/gnus/mm-decode.el lisp/gnus/mm-util.el lisp/gnus/nneething.el
diffstat 8 files changed, 53 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/ChangeLog	Thu Mar 21 19:11:23 2002 +0000
@@ -1,7 +1,22 @@
-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>
 
--- a/lisp/gnus/gnus-start.el	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/gnus-start.el	Thu Mar 21 19:11:23 2002 +0000
@@ -2500,7 +2500,7 @@
   (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))
--- a/lisp/gnus/gnus-uu.el	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/gnus-uu.el	Thu Mar 21 19:11:23 2002 +0000
@@ -457,7 +457,7 @@
 			  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 @@
 	 (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 @@
   "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-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)
--- a/lisp/gnus/mail-source.el	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/mail-source.el	Thu Mar 21 19:11:23 2002 +0000
@@ -450,13 +450,16 @@
 		    (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.
--- a/lisp/gnus/message.el	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/message.el	Thu Mar 21 19:11:23 2002 +0000
@@ -1546,7 +1546,8 @@
     (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)
--- a/lisp/gnus/mm-decode.el	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/mm-decode.el	Thu Mar 21 19:11:23 2002 +0000
@@ -400,7 +400,8 @@
 		  (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 @@
 	       (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 @@
 			  ;; (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
--- a/lisp/gnus/mm-util.el	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/mm-util.el	Thu Mar 21 19:11:23 2002 +0000
@@ -723,6 +723,20 @@
 	  (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
--- a/lisp/gnus/nneething.el	Thu Mar 21 13:02:34 2002 +0000
+++ b/lisp/gnus/nneething.el	Thu Mar 21 19:11:23 2002 +0000
@@ -365,7 +365,7 @@
     (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)