From xemacs-m  Mon Feb 17 20:00:07 1997
Received: from mecca.spd.louisville.edu (mecca.spd.louisville.edu [136.165.40.148])
	by xemacs.org (8.8.5/8.8.5) with SMTP id UAA24580
	for <xemacs-beta@xemacs.org>; Mon, 17 Feb 1997 20:00:06 -0600 (CST)
Received: (from tjchol01@localhost) by mecca.spd.louisville.edu (950413.SGI.8.6.12/8.6.12) id CAA02586; Tue, 18 Feb 1997 02:00:10 GMT
Date: Tue, 18 Feb 1997 02:00:10 GMT
Message-Id: <199702180200.CAA02586@mecca.spd.louisville.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: "Tomasz J. Cholewo" <T.Cholewo@ieee.org>
To: XEmacs-Beta Listserv <xemacs-beta@xemacs.org>
Subject: [patch] VM-6.13 MIME attachment saving modification

The following patch enables saving the attached file under its default
name by specifying the new save directory only.  This behavior is
analogous to what the standard `write-file' does.  The difference is an
additional test for attempts to save a file under an existing directory
name.  It is here to avoid potentially time-consuming decoding which
would end in an error anyway.

Tom

P.S.  Is it OK to post VM patches here, or should I use vm-bug or
vm-info instead? 
================= CUT HERE ===================
--- vm-mime.el.orig	Sun Feb  9 05:21:09 1997
+++ vm-mime.el	Mon Feb 17 20:33:27 1997
@@ -1753,6 +1753,17 @@
 	     "Write MIME body to file: ")
 	   vm-mime-attachment-save-directory default-filename)
 	  file (expand-file-name file vm-mime-attachment-save-directory))
+    ;; If arg is just a directory, use same file name, but in 
+    ;; that directory, as in `write-file'. (tjc)
+    (if (file-directory-p file) 
+	(if default-filename
+	    (setq file (concat (file-name-as-directory file)
+			       (file-name-nondirectory default-filename)))
+	  ;; Signal error *before* starting to decode.
+	  (error (format "No file name in `%s'" file))))
+    (or (not (file-exists-p file))
+	(y-or-n-p (format "File `%s' exists; overwrite? " file))
+	(error "Canceled"))
     (save-excursion
       (unwind-protect
 	  (progn
@@ -1763,9 +1774,6 @@
 	    (setq buffer-file-type (not (vm-mime-text-type-p layout)))
 	    (vm-mime-insert-mime-body layout)
 	    (vm-mime-transfer-decode-region layout (point-min) (point-max))
-	    (or (not (file-exists-p file))
-		(y-or-n-p "File exists, overwrite? ")
-		(error "Aborted"))
 	    (write-region (point-min) (point-max) file nil nil))
 	(and work-buffer (kill-buffer work-buffer))))))
 

