diff src/fileio.c @ 103917:aa5e8ff5a9c4

* fileio.c (Fwrite_region, Fdo_auto_save): Handle save_length = -2. (Fset_buffer_auto_saved): Handle save_length = -2. Comment changes in other files.
author Richard M. Stallman <rms@gnu.org>
date Thu, 16 Jul 2009 01:45:08 +0000
parents 41dca7756517
children 65ac865116fc
line wrap: on
line diff
--- a/src/fileio.c	Thu Jul 16 01:24:00 2009 +0000
+++ b/src/fileio.c	Thu Jul 16 01:45:08 2009 +0000
@@ -4492,7 +4492,8 @@
       if (visiting)
 	{
 	  SAVE_MODIFF = MODIFF;
-	  XSETFASTINT (current_buffer->save_length, Z - BEG);
+	  if (XINT (current_buffer->save_length) != -2)
+	    XSETFASTINT (current_buffer->save_length, Z - BEG);
 	  current_buffer->filename = visit_file;
 	}
       UNGCPRO;
@@ -4703,7 +4704,8 @@
   if (visiting)
     {
       SAVE_MODIFF = MODIFF;
-      XSETFASTINT (current_buffer->save_length, Z - BEG);
+      if (XINT (current_buffer->save_length) != -2)
+	XSETFASTINT (current_buffer->save_length, Z - BEG);
       current_buffer->filename = visit_file;
       update_mode_lines++;
     }
@@ -5307,7 +5309,7 @@
 	    && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
 	    && b->auto_save_modified < BUF_MODIFF (b)
 	    /* -1 means we've turned off autosaving for a while--see below.  */
-	    && XINT (b->save_length) >= 0
+	    && XINT (b->save_length) != -1
 	    && (do_handled_files
 		|| NILP (Ffind_file_name_handler (b->auto_save_file_name,
 						  Qwrite_region))))
@@ -5321,8 +5323,10 @@
 		&& EMACS_SECS (before_time) - b->auto_save_failure_time < 1200)
 	      continue;
 
-	    if ((XFASTINT (b->save_length) * 10
-		 > (BUF_Z (b) - BUF_BEG (b)) * 13)
+	    if (XINT (b->save_length) != -2
+		/* -2 is a magic flag turning off this feature in a buffer.  */
+		&& (XFASTINT (b->save_length) * 10
+		    > (BUF_Z (b) - BUF_BEG (b)) * 13)
 		/* A short file is likely to change a large fraction;
 		   spare the user annoying messages.  */
 		&& XFASTINT (b->save_length) > 5000
@@ -5347,7 +5351,8 @@
 	    internal_condition_case (auto_save_1, Qt, auto_save_error);
 	    auto_saved++;
 	    b->auto_save_modified = BUF_MODIFF (b);
-	    XSETFASTINT (current_buffer->save_length, Z - BEG);
+	    if (XINT (current_buffer->save_length) != -2)
+	      XSETFASTINT (current_buffer->save_length, Z - BEG);
 	    set_buffer_internal (old);
 
 	    EMACS_GET_TIME (after_time);
@@ -5392,7 +5397,8 @@
      ()
 {
   current_buffer->auto_save_modified = MODIFF;
-  XSETFASTINT (current_buffer->save_length, Z - BEG);
+  if (XINT (current_buffer->save_length) != -2)
+    XSETFASTINT (current_buffer->save_length, Z - BEG);
   current_buffer->auto_save_failure_time = -1;
   return Qnil;
 }