Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.336
diff -p -u -r1.336 e-msg-composer.c
--- composer/e-msg-composer.c	4 Oct 2002 18:10:44 -0000	1.336
+++ composer/e-msg-composer.c	26 Nov 2002 14:00:43 -0000
@@ -1230,8 +1230,20 @@ autosave_save_draft (EMsgComposer *compo
 	CamelStream *stream;
 	char *file;
 	int fd;
+	CORBA_Environment ev;
+	gboolean rv;
 	gboolean success = TRUE;
 	
+	if (!composer->has_changed_autosave) {
+		CORBA_exception_init (&ev);
+		rv = GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "is-autosaved", &ev);
+		CORBA_exception_free (&ev);
+
+		if (rv) {
+			return TRUE;
+		}
+	}
+
 	fd = composer->autosave_fd;
 	file = composer->autosave_file;
 	
@@ -1271,6 +1283,12 @@ autosave_save_draft (EMsgComposer *compo
 			  _("Error autosaving message: %s\n %s"), file, strerror(errno));
 		
 		success = FALSE;
+	} else {
+		CORBA_exception_init (&ev);
+		GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "autosaved", &ev);
+		CORBA_exception_free (&ev);
+
+		composer->has_changed_autosave = FALSE;
 	}
 	
 	/* set the fd to -1 in the stream so camel doesn't close it we want to keep it open */
@@ -2154,6 +2172,9 @@ subject_changed_cb (EMsgComposerHdrs *hd
 		gtk_window_set_title (GTK_WINDOW (composer),
 				      _("Compose a message"));
 	g_free (subject);
+	
+	/* Mark the composer as changed so it prompts about unsaved changes on close */
+	e_msg_composer_set_changed (composer);
 }
 
 static void
@@ -2587,6 +2608,7 @@ init (EMsgComposer *composer)
 	composer->smime_encrypt            = FALSE;
 	
 	composer->has_changed              = FALSE;
+	composer->has_changed_autosave     = TRUE;
 	
 	composer->redirect                 = FALSE;
 	
@@ -4639,6 +4661,7 @@ e_msg_composer_set_changed (EMsgComposer
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 	
 	composer->has_changed = TRUE;
+	composer->has_changed_autosave = TRUE;
 }
 
 
Index: composer/e-msg-composer.h
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.h,v
retrieving revision 1.74
diff -p -u -r1.74 e-msg-composer.h
--- composer/e-msg-composer.h	25 Jul 2002 18:19:46 -0000	1.74
+++ composer/e-msg-composer.h	26 Nov 2002 14:00:44 -0000
@@ -95,6 +95,7 @@ struct _EMsgComposer {
 	guint32 view_cc                : 1;
 	guint32 view_subject           : 1;
 	guint32 has_changed            : 1;
+	guint32 has_changed_autosave   : 1;
 	
 	guint32 mode_post              : 1;
 	
