aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/buffer.c7
-rw-r--r--src/buffer.h3
-rw-r--r--src/fileio.c20
4 files changed, 27 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 999269f60a8..698ab0d58dd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12009-07-16 Richard Stallman <rms@gnu.org>
2
3 * fileio.c (Fwrite_region, Fdo_auto_save): Handle save_length = -2.
4 (Fset_buffer_auto_saved): Handle save_length = -2.
5
12009-07-16 Chong Yidong <cyd@stupidchicken.com> 62009-07-16 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * xterm.c (Qx_gtk_map_stock): New var. 8 * xterm.c (Qx_gtk_map_stock): New var.
diff --git a/src/buffer.c b/src/buffer.c
index f06a6c06a92..f811f162ef2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5853,7 +5853,12 @@ Backing up is done before the first time the file is saved. */);
5853 DEFVAR_PER_BUFFER ("buffer-saved-size", &current_buffer->save_length, 5853 DEFVAR_PER_BUFFER ("buffer-saved-size", &current_buffer->save_length,
5854 make_number (Lisp_Int), 5854 make_number (Lisp_Int),
5855 doc: /* Length of current buffer when last read in, saved or auto-saved. 5855 doc: /* Length of current buffer when last read in, saved or auto-saved.
58560 initially. */); 58560 initially.
5857-1 means auto-saving turned off until next real save.
5858
5859If you set this to -2, that means don't turn off auto-saving in this buffer
5860if its text size shrinks. If you use `buffer-swap-text' on a buffer,
5861you probably should set this to -2 in that buffer. */);
5857 5862
5858 DEFVAR_PER_BUFFER ("selective-display", &current_buffer->selective_display, 5863 DEFVAR_PER_BUFFER ("selective-display", &current_buffer->selective_display,
5859 Qnil, 5864 Qnil,
diff --git a/src/buffer.h b/src/buffer.h
index 1fb322e3ed9..397b97579e6 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -584,6 +584,9 @@ struct buffer
584 /* This isn't really used by the C code, so could be deleted. */ 584 /* This isn't really used by the C code, so could be deleted. */
585 Lisp_Object backed_up; 585 Lisp_Object backed_up;
586 /* Length of file when last read or saved. 586 /* Length of file when last read or saved.
587 -1 means auto saving turned off because buffer shrank a lot.
588 -2 means don't turn off auto saving if buffer shrinks.
589 (That value is used with buffer-swap-text.)
587 This is not in the struct buffer_text 590 This is not in the struct buffer_text
588 because it's not used in indirect buffers at all. */ 591 because it's not used in indirect buffers at all. */
589 Lisp_Object save_length; 592 Lisp_Object save_length;
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}