From: Dave Love <fx@gnu.org>
Date: Wed, 24 May 2000 14:13:20 +0000 (+0000)
Subject: 1999-06-01  Kenichi HANDA  <handa@etl.go.jp>
X-Git-Tag: emacs-pretest-21.0.90~3748
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f8569325db7b3fc9a5849cb5cff32dd207be8522;p=emacs.git

1999-06-01  Kenichi HANDA  <handa@etl.go.jp>

	* fileio.c (Finsert_file_contents): Even if a file is not found,
	execute codes for setting up coding system.  Call
	after-insert-file-functions unconditionally
---

diff --git a/src/ChangeLog b/src/ChangeLog
index 16737c6f38f..2a50cd86799 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2000-05-24  Kenichi HANDA  <handa@etl.go.jp>
+
+	* fileio.c (Finsert_file_contents): Even if a file is not found,
+	execute codes for setting up coding system.  Call
+	after-insert-file-functions unconditionally.
+
 2000-05-24  Gerd Moellmann  <gerd@gnu.org>
 
 	* callproc.c, emacs.c, sysdep.c (setpgrp): Don't define if USG and
diff --git a/src/fileio.c b/src/fileio.c
index 19d80a9d2f0..47bc651a021 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3643,6 +3643,8 @@ actually used.")
 	}
 
       setup_coding_system (Fcheck_coding_system (val), &coding);
+      /* Ensure we set Vlast_coding_system_used.  */
+      set_coding_system = 1;
 
       if (NILP (current_buffer->enable_multibyte_characters)
 	  && ! NILP (val))
@@ -3656,9 +3658,6 @@ actually used.")
       coding_system_decided = 1;
     }
 
-  /* Ensure we always set Vlast_coding_system_used.  */
-  set_coding_system = 1;
-
   /* If requested, replace the accessible part of the buffer
      with the file contents.  Avoid replacing text at the
      beginning or end of the buffer that matches the file contents;
@@ -4133,6 +4132,8 @@ actually used.")
     error ("IO error reading %s: %s",
 	   XSTRING (orig_filename)->data, emacs_strerror (errno));
 
+ notfound:
+
   if (! coding_system_decided)
     {
       /* The coding system is not yet decided.  Decide it by an
@@ -4195,6 +4196,8 @@ actually used.")
 	setup_coding_system (val, &temp_coding);
 	bcopy (&temp_coding, &coding, sizeof coding);
       }
+      /* Ensure we set Vlast_coding_system_used.  */
+      set_coding_system = 1;
 
       if (NILP (current_buffer->enable_multibyte_characters)
 	  && ! NILP (val))
@@ -4238,7 +4241,6 @@ actually used.")
     current_buffer->buffer_file_type = Qnil;
 #endif
 
- notfound:
  handled:
 
   if (!NILP (visit))
@@ -4270,10 +4272,6 @@ actually used.")
 	Fsignal (Qfile_error,
 		 Fcons (build_string ("not a regular file"),
 			Fcons (orig_filename, Qnil)));
-
-      /* If visiting nonexistent file, return nil.  */
-      if (current_buffer->modtime == -1)
-	report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
     }
 
   /* Decode file format */
@@ -4298,20 +4296,24 @@ actually used.")
       update_compositions (PT, PT, CHECK_BORDER);
     }
 
-  if (inserted > 0)
+  p = Vafter_insert_file_functions;
+  while (!NILP (p))
     {
-      p = Vafter_insert_file_functions;
-      while (!NILP (p))
+      insval = call1 (Fcar (p), make_number (inserted));
+      if (!NILP (insval))
 	{
-	  insval = call1 (Fcar (p), make_number (inserted));
-	  if (!NILP (insval))
-	    {
-	      CHECK_NUMBER (insval, 0);
-	      inserted = XFASTINT (insval);
-	    }
-	  QUIT;
-	  p = Fcdr (p);
+	  CHECK_NUMBER (insval, 0);
+	  inserted = XFASTINT (insval);
 	}
+      QUIT;
+      p = Fcdr (p);
+    }
+
+  if (!NILP (visit)
+      && current_buffer->modtime == -1)
+    {
+      /* If visiting nonexistent file, return nil.  */
+      report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
     }
 
   /* ??? Retval needs to be dealt with in all cases consistently.  */