aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorRichard M. Stallman2009-07-16 01:45:08 +0000
committerRichard M. Stallman2009-07-16 01:45:08 +0000
commit4be941e3d033e95db26ce46c14e44bdcf193e638 (patch)
tree5d738d110e0378ca72018a2ef4150e2145a14645 /src/fileio.c
parent4e6b227dbe52c61ca54df5fc0597fb190734210d (diff)
downloademacs-4be941e3d033e95db26ce46c14e44bdcf193e638.tar.gz
emacs-4be941e3d033e95db26ce46c14e44bdcf193e638.zip
* fileio.c (Fwrite_region, Fdo_auto_save): Handle save_length = -2.
(Fset_buffer_auto_saved): Handle save_length = -2. Comment changes in other files.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/fileio.c b/src/fileio.c
index bf96b3aa2b1..43872d59472 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4492,7 +4492,8 @@ This calls `write-region-annotate-functions' at the start, and
4492 if (visiting) 4492 if (visiting)
4493 { 4493 {
4494 SAVE_MODIFF = MODIFF; 4494 SAVE_MODIFF = MODIFF;
4495 XSETFASTINT (current_buffer->save_length, Z - BEG); 4495 if (XINT (current_buffer->save_length) != -2)
4496 XSETFASTINT (current_buffer->save_length, Z - BEG);
4496 current_buffer->filename = visit_file; 4497 current_buffer->filename = visit_file;
4497 } 4498 }
4498 UNGCPRO; 4499 UNGCPRO;
@@ -4703,7 +4704,8 @@ This calls `write-region-annotate-functions' at the start, and
4703 if (visiting) 4704 if (visiting)
4704 { 4705 {
4705 SAVE_MODIFF = MODIFF; 4706 SAVE_MODIFF = MODIFF;
4706 XSETFASTINT (current_buffer->save_length, Z - BEG); 4707 if (XINT (current_buffer->save_length) != -2)
4708 XSETFASTINT (current_buffer->save_length, Z - BEG);
4707 current_buffer->filename = visit_file; 4709 current_buffer->filename = visit_file;
4708 update_mode_lines++; 4710 update_mode_lines++;
4709 } 4711 }
@@ -5307,7 +5309,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5307 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 5309 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
5308 && b->auto_save_modified < BUF_MODIFF (b) 5310 && b->auto_save_modified < BUF_MODIFF (b)
5309 /* -1 means we've turned off autosaving for a while--see below. */ 5311 /* -1 means we've turned off autosaving for a while--see below. */
5310 && XINT (b->save_length) >= 0 5312 && XINT (b->save_length) != -1
5311 && (do_handled_files 5313 && (do_handled_files
5312 || NILP (Ffind_file_name_handler (b->auto_save_file_name, 5314 || NILP (Ffind_file_name_handler (b->auto_save_file_name,
5313 Qwrite_region)))) 5315 Qwrite_region))))
@@ -5321,8 +5323,10 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5321 && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) 5323 && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200)
5322 continue; 5324 continue;
5323 5325
5324 if ((XFASTINT (b->save_length) * 10 5326 if (XINT (b->save_length) != -2
5325 > (BUF_Z (b) - BUF_BEG (b)) * 13) 5327 /* -2 is a magic flag turning off this feature in a buffer. */
5328 && (XFASTINT (b->save_length) * 10
5329 > (BUF_Z (b) - BUF_BEG (b)) * 13)
5326 /* A short file is likely to change a large fraction; 5330 /* A short file is likely to change a large fraction;
5327 spare the user annoying messages. */ 5331 spare the user annoying messages. */
5328 && XFASTINT (b->save_length) > 5000 5332 && XFASTINT (b->save_length) > 5000
@@ -5347,7 +5351,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5347 internal_condition_case (auto_save_1, Qt, auto_save_error); 5351 internal_condition_case (auto_save_1, Qt, auto_save_error);
5348 auto_saved++; 5352 auto_saved++;
5349 b->auto_save_modified = BUF_MODIFF (b); 5353 b->auto_save_modified = BUF_MODIFF (b);
5350 XSETFASTINT (current_buffer->save_length, Z - BEG); 5354 if (XINT (current_buffer->save_length) != -2)
5355 XSETFASTINT (current_buffer->save_length, Z - BEG);
5351 set_buffer_internal (old); 5356 set_buffer_internal (old);
5352 5357
5353 EMACS_GET_TIME (after_time); 5358 EMACS_GET_TIME (after_time);
@@ -5392,7 +5397,8 @@ No auto-save file will be written until the buffer changes again. */)
5392 () 5397 ()
5393{ 5398{
5394 current_buffer->auto_save_modified = MODIFF; 5399 current_buffer->auto_save_modified = MODIFF;
5395 XSETFASTINT (current_buffer->save_length, Z - BEG); 5400 if (XINT (current_buffer->save_length) != -2)
5401 XSETFASTINT (current_buffer->save_length, Z - BEG);
5396 current_buffer->auto_save_failure_time = -1; 5402 current_buffer->auto_save_failure_time = -1;
5397 return Qnil; 5403 return Qnil;
5398} 5404}