diff --git a/src/files.c b/src/files.c
index fd60df8063ccf021ee7a249c33afd160383fd937..a8de66bfdf5bf12079bcfabfc65f0e256e405dd9 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1031,6 +1031,7 @@ void do_insertfile(void)
     char *given = mallocstrcpy(NULL, "");
 	/* The last answer the user typed at the statusbar prompt. */
 #ifndef NANO_TINY
+    file_format original_fmt = openfile->fmt;
     bool execute = FALSE;
 #endif
 
@@ -1177,7 +1178,10 @@ void do_insertfile(void)
 		if (openfile->current->lineno != was_current_lineno ||
 			openfile->current_x != was_current_x)
 		    set_modified();
-
+#ifndef NANO_TINY
+		/* Don't change the format of the current file. */
+		openfile->fmt = original_fmt;
+#endif
 		refresh_needed = TRUE;
 	    }