changeset 5410:c96b98efb5b4

(Fwrite_region): Don't change START and END from nil until after checking for a magic handler.
author Richard M. Stallman <rms@gnu.org>
date Sat, 01 Jan 1994 18:01:49 +0000
parents a5c38a92e787
children c002b55b9cac
files src/fileio.c
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Sat Jan 01 17:32:23 1994 +0000
+++ b/src/fileio.c	Sat Jan 01 18:01:49 1994 +0000
@@ -2628,22 +2628,16 @@
   int visiting, quietly;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
-  /* Special kludge to simplify auto-saving */
-  if (NILP (start))
-    {
-      XFASTINT (start) = BEG;
-      XFASTINT (end) = Z;
-    }
-  else if (XTYPE (start) != Lisp_String)
+  if (!NILP (start) && !STRINGP (start))
     validate_region (&start, &end);
 
   filename = Fexpand_file_name (filename, Qnil);
-  if (XTYPE (visit) == Lisp_String)
+  if (STRINGP (visit))
     visit_file = Fexpand_file_name (visit, Qnil);
   else
     visit_file = filename;
 
-  visiting = (EQ (visit, Qt) || XTYPE (visit) == Lisp_String);
+  visiting = (EQ (visit, Qt) || STRINGP (visit));
   quietly = !NILP (visit);
 
   annotations = Qnil;
@@ -2670,6 +2664,13 @@
       return val;
     }
 
+  /* Special kludge to simplify auto-saving.  */
+  if (NILP (start))
+    {
+      XFASTINT (start) = BEG;
+      XFASTINT (end) = Z;
+    }
+
   annotations = build_annotations (start, end);
 
 #ifdef CLASH_DETECTION
@@ -2689,7 +2690,7 @@
 	vms_truncate (fn);	/* if fn exists, truncate to zero length */
 	desc = open (fn, O_RDWR);
 	if (desc < 0)
-	  desc = creat_copy_attrs (XTYPE (current_buffer->filename) == Lisp_String
+	  desc = creat_copy_attrs (STRINGP (current_buffer->filename)
 				   ? XSTRING (current_buffer->filename)->data : 0,
 				   fn);
       }
@@ -2778,7 +2779,7 @@
   failure = 0;
   immediate_quit = 1;
 
-  if (XTYPE (start) == Lisp_String)
+  if (STRINGP (start))
     {
       failure = 0 > a_write (desc, XSTRING (start)->data,
 			     XSTRING (start)->size, 0, &annotations);