From: Richard M. Stallman Date: Sat, 1 Jan 1994 18:01:49 +0000 (+0000) Subject: (Fwrite_region): Don't change START and END from nil X-Git-Tag: emacs-19.34~10441 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=561cb8e159e7eff7a6487a45a1cfab47ba456030;p=emacs.git (Fwrite_region): Don't change START and END from nil until after checking for a magic handler. --- diff --git a/src/fileio.c b/src/fileio.c index 9b196c2a87a..8b532efa11f 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2628,22 +2628,16 @@ to the file, instead of any buffer contents, and END is ignored.") 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 @@ to the file, instead of any buffer contents, and END is ignored.") 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 @@ to the file, instead of any buffer contents, and END is ignored.") 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 @@ to the file, instead of any buffer contents, and END is ignored.") 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);