aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-01-01 18:01:49 +0000
committerRichard M. Stallman1994-01-01 18:01:49 +0000
commit561cb8e159e7eff7a6487a45a1cfab47ba456030 (patch)
tree121617346efe51ad8522856e3be66debd4934ca1 /src
parent7bdf031dc835e1a8c20fd458a627bb183a7c53fe (diff)
downloademacs-561cb8e159e7eff7a6487a45a1cfab47ba456030.tar.gz
emacs-561cb8e159e7eff7a6487a45a1cfab47ba456030.zip
(Fwrite_region): Don't change START and END from nil
until after checking for a magic handler.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c23
1 files changed, 12 insertions, 11 deletions
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.")
2628 int visiting, quietly; 2628 int visiting, quietly;
2629 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 2629 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
2630 2630
2631 /* Special kludge to simplify auto-saving */ 2631 if (!NILP (start) && !STRINGP (start))
2632 if (NILP (start))
2633 {
2634 XFASTINT (start) = BEG;
2635 XFASTINT (end) = Z;
2636 }
2637 else if (XTYPE (start) != Lisp_String)
2638 validate_region (&start, &end); 2632 validate_region (&start, &end);
2639 2633
2640 filename = Fexpand_file_name (filename, Qnil); 2634 filename = Fexpand_file_name (filename, Qnil);
2641 if (XTYPE (visit) == Lisp_String) 2635 if (STRINGP (visit))
2642 visit_file = Fexpand_file_name (visit, Qnil); 2636 visit_file = Fexpand_file_name (visit, Qnil);
2643 else 2637 else
2644 visit_file = filename; 2638 visit_file = filename;
2645 2639
2646 visiting = (EQ (visit, Qt) || XTYPE (visit) == Lisp_String); 2640 visiting = (EQ (visit, Qt) || STRINGP (visit));
2647 quietly = !NILP (visit); 2641 quietly = !NILP (visit);
2648 2642
2649 annotations = Qnil; 2643 annotations = Qnil;
@@ -2670,6 +2664,13 @@ to the file, instead of any buffer contents, and END is ignored.")
2670 return val; 2664 return val;
2671 } 2665 }
2672 2666
2667 /* Special kludge to simplify auto-saving. */
2668 if (NILP (start))
2669 {
2670 XFASTINT (start) = BEG;
2671 XFASTINT (end) = Z;
2672 }
2673
2673 annotations = build_annotations (start, end); 2674 annotations = build_annotations (start, end);
2674 2675
2675#ifdef CLASH_DETECTION 2676#ifdef CLASH_DETECTION
@@ -2689,7 +2690,7 @@ to the file, instead of any buffer contents, and END is ignored.")
2689 vms_truncate (fn); /* if fn exists, truncate to zero length */ 2690 vms_truncate (fn); /* if fn exists, truncate to zero length */
2690 desc = open (fn, O_RDWR); 2691 desc = open (fn, O_RDWR);
2691 if (desc < 0) 2692 if (desc < 0)
2692 desc = creat_copy_attrs (XTYPE (current_buffer->filename) == Lisp_String 2693 desc = creat_copy_attrs (STRINGP (current_buffer->filename)
2693 ? XSTRING (current_buffer->filename)->data : 0, 2694 ? XSTRING (current_buffer->filename)->data : 0,
2694 fn); 2695 fn);
2695 } 2696 }
@@ -2778,7 +2779,7 @@ to the file, instead of any buffer contents, and END is ignored.")
2778 failure = 0; 2779 failure = 0;
2779 immediate_quit = 1; 2780 immediate_quit = 1;
2780 2781
2781 if (XTYPE (start) == Lisp_String) 2782 if (STRINGP (start))
2782 { 2783 {
2783 failure = 0 > a_write (desc, XSTRING (start)->data, 2784 failure = 0 > a_write (desc, XSTRING (start)->data,
2784 XSTRING (start)->size, 0, &annotations); 2785 XSTRING (start)->size, 0, &annotations);