aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/fileio.c b/src/fileio.c
index a1b202581f1..079c7d0dc7c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2752,12 +2752,16 @@ and (2) it puts less data in the undo list.")
2752 int total; 2752 int total;
2753 int not_regular = 0; 2753 int not_regular = 0;
2754 2754
2755 if (current_buffer->base_buffer && ! NILP (visit))
2756 error ("Cannot do file visiting in an indirect buffer");
2757
2758 if (!NILP (current_buffer->read_only))
2759 Fbarf_if_buffer_read_only ();
2760
2755 val = Qnil; 2761 val = Qnil;
2756 p = Qnil; 2762 p = Qnil;
2757 2763
2758 GCPRO3 (filename, val, p); 2764 GCPRO3 (filename, val, p);
2759 if (!NILP (current_buffer->read_only))
2760 Fbarf_if_buffer_read_only();
2761 2765
2762 CHECK_STRING (filename, 0); 2766 CHECK_STRING (filename, 0);
2763 filename = Fexpand_file_name (filename, Qnil); 2767 filename = Fexpand_file_name (filename, Qnil);
@@ -3057,7 +3061,7 @@ and (2) it puts less data in the undo list.")
3057 current_buffer->filename = filename; 3061 current_buffer->filename = filename;
3058 } 3062 }
3059 3063
3060 current_buffer->save_modified = MODIFF; 3064 SAVE_MODIFF = MODIFF;
3061 current_buffer->auto_save_modified = MODIFF; 3065 current_buffer->auto_save_modified = MODIFF;
3062 XSETFASTINT (current_buffer->save_length, Z - BEG); 3066 XSETFASTINT (current_buffer->save_length, Z - BEG);
3063#ifdef CLASH_DETECTION 3067#ifdef CLASH_DETECTION
@@ -3166,6 +3170,9 @@ to the file, instead of any buffer contents, and END is ignored.")
3166 = NILP (current_buffer->buffer_file_type) ? O_TEXT : O_BINARY; 3170 = NILP (current_buffer->buffer_file_type) ? O_TEXT : O_BINARY;
3167#endif /* DOS_NT */ 3171#endif /* DOS_NT */
3168 3172
3173 if (current_buffer->base_buffer && ! NILP (visit))
3174 error ("Cannot do file visiting in an indirect buffer");
3175
3169 if (!NILP (start) && !STRINGP (start)) 3176 if (!NILP (start) && !STRINGP (start))
3170 validate_region (&start, &end); 3177 validate_region (&start, &end);
3171 3178
@@ -3199,7 +3206,7 @@ to the file, instead of any buffer contents, and END is ignored.")
3199 3206
3200 if (visiting) 3207 if (visiting)
3201 { 3208 {
3202 current_buffer->save_modified = MODIFF; 3209 SAVE_MODIFF = MODIFF;
3203 XSETFASTINT (current_buffer->save_length, Z - BEG); 3210 XSETFASTINT (current_buffer->save_length, Z - BEG);
3204 current_buffer->filename = visit_file; 3211 current_buffer->filename = visit_file;
3205 } 3212 }
@@ -3446,7 +3453,7 @@ to the file, instead of any buffer contents, and END is ignored.")
3446 3453
3447 if (visiting) 3454 if (visiting)
3448 { 3455 {
3449 current_buffer->save_modified = MODIFF; 3456 SAVE_MODIFF = MODIFF;
3450 XSETFASTINT (current_buffer->save_length, Z - BEG); 3457 XSETFASTINT (current_buffer->save_length, Z - BEG);
3451 current_buffer->filename = visit_file; 3458 current_buffer->filename = visit_file;
3452 update_mode_lines++; 3459 update_mode_lines++;
@@ -3810,11 +3817,16 @@ Non-nil second argument means save only current buffer.")
3810 && b != current_buffer) 3817 && b != current_buffer)
3811 continue; 3818 continue;
3812 3819
3820 /* Don't auto-save indirect buffers.
3821 The base buffer takes care of it. */
3822 if (b->base_buffer)
3823 continue;
3824
3813 /* Check for auto save enabled 3825 /* Check for auto save enabled
3814 and file changed since last auto save 3826 and file changed since last auto save
3815 and file changed since last real save. */ 3827 and file changed since last real save. */
3816 if (STRINGP (b->auto_save_file_name) 3828 if (STRINGP (b->auto_save_file_name)
3817 && b->save_modified < BUF_MODIFF (b) 3829 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
3818 && b->auto_save_modified < BUF_MODIFF (b) 3830 && b->auto_save_modified < BUF_MODIFF (b)
3819 /* -1 means we've turned off autosaving for a while--see below. */ 3831 /* -1 means we've turned off autosaving for a while--see below. */
3820 && XINT (b->save_length) >= 0 3832 && XINT (b->save_length) >= 0
@@ -3911,7 +3923,7 @@ DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p,
3911 "Return t if buffer has been auto-saved since last read in or saved.") 3923 "Return t if buffer has been auto-saved since last read in or saved.")
3912 () 3924 ()
3913{ 3925{
3914 return (current_buffer->save_modified < current_buffer->auto_save_modified) ? Qt : Qnil; 3926 return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil;
3915} 3927}
3916 3928
3917/* Reading and completing file names */ 3929/* Reading and completing file names */