diff options
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/fileio.c | 29 |
2 files changed, 24 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b3410b1c69e..e15c3e7937f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2009-07-21 Chong Yidong <cyd@stupidchicken.com> | 1 | 2009-07-21 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 2 | ||
| 3 | * fileio.c: Revert 2009-07-16 changes. | ||
| 4 | (Vauto_save_include_big_deletions): New variable. | ||
| 5 | (Fdo_auto_save): Disable auto-save only if | ||
| 6 | auto-save-include-big-deletions is nil. | ||
| 7 | |||
| 8 | 2009-07-21 Chong Yidong <cyd@stupidchicken.com> | ||
| 9 | |||
| 3 | * xdisp.c (move_it_to): For continued lines ending in a tab, take | 10 | * xdisp.c (move_it_to): For continued lines ending in a tab, take |
| 4 | the overflowed pixels into account (Bug#3879). | 11 | the overflowed pixels into account (Bug#3879). |
| 5 | 12 | ||
diff --git a/src/fileio.c b/src/fileio.c index 43872d59472..3702d4cc1b8 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -193,6 +193,9 @@ Lisp_Object Vauto_save_list_file_name; | |||
| 193 | /* Whether or not files are auto-saved into themselves. */ | 193 | /* Whether or not files are auto-saved into themselves. */ |
| 194 | Lisp_Object Vauto_save_visited_file_name; | 194 | Lisp_Object Vauto_save_visited_file_name; |
| 195 | 195 | ||
| 196 | /* Whether or not to continue auto-saving after a large deletion. */ | ||
| 197 | Lisp_Object Vauto_save_include_big_deletions; | ||
| 198 | |||
| 196 | /* On NT, specifies the directory separator character, used (eg.) when | 199 | /* On NT, specifies the directory separator character, used (eg.) when |
| 197 | expanding file names. This can be bound to / or \. */ | 200 | expanding file names. This can be bound to / or \. */ |
| 198 | Lisp_Object Vdirectory_sep_char; | 201 | Lisp_Object Vdirectory_sep_char; |
| @@ -4492,8 +4495,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4492 | if (visiting) | 4495 | if (visiting) |
| 4493 | { | 4496 | { |
| 4494 | SAVE_MODIFF = MODIFF; | 4497 | SAVE_MODIFF = MODIFF; |
| 4495 | if (XINT (current_buffer->save_length) != -2) | 4498 | XSETFASTINT (current_buffer->save_length, Z - BEG); |
| 4496 | XSETFASTINT (current_buffer->save_length, Z - BEG); | ||
| 4497 | current_buffer->filename = visit_file; | 4499 | current_buffer->filename = visit_file; |
| 4498 | } | 4500 | } |
| 4499 | UNGCPRO; | 4501 | UNGCPRO; |
| @@ -4704,8 +4706,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4704 | if (visiting) | 4706 | if (visiting) |
| 4705 | { | 4707 | { |
| 4706 | SAVE_MODIFF = MODIFF; | 4708 | SAVE_MODIFF = MODIFF; |
| 4707 | if (XINT (current_buffer->save_length) != -2) | 4709 | XSETFASTINT (current_buffer->save_length, Z - BEG); |
| 4708 | XSETFASTINT (current_buffer->save_length, Z - BEG); | ||
| 4709 | current_buffer->filename = visit_file; | 4710 | current_buffer->filename = visit_file; |
| 4710 | update_mode_lines++; | 4711 | update_mode_lines++; |
| 4711 | } | 4712 | } |
| @@ -5309,7 +5310,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5309 | && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) | 5310 | && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) |
| 5310 | && b->auto_save_modified < BUF_MODIFF (b) | 5311 | && b->auto_save_modified < BUF_MODIFF (b) |
| 5311 | /* -1 means we've turned off autosaving for a while--see below. */ | 5312 | /* -1 means we've turned off autosaving for a while--see below. */ |
| 5312 | && XINT (b->save_length) != -1 | 5313 | && XINT (b->save_length) >= 0 |
| 5313 | && (do_handled_files | 5314 | && (do_handled_files |
| 5314 | || NILP (Ffind_file_name_handler (b->auto_save_file_name, | 5315 | || NILP (Ffind_file_name_handler (b->auto_save_file_name, |
| 5315 | Qwrite_region)))) | 5316 | Qwrite_region)))) |
| @@ -5323,8 +5324,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5323 | && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) | 5324 | && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) |
| 5324 | continue; | 5325 | continue; |
| 5325 | 5326 | ||
| 5326 | if (XINT (b->save_length) != -2 | 5327 | set_buffer_internal (b); |
| 5327 | /* -2 is a magic flag turning off this feature in a buffer. */ | 5328 | if (NILP (Vauto_save_include_big_deletions) |
| 5328 | && (XFASTINT (b->save_length) * 10 | 5329 | && (XFASTINT (b->save_length) * 10 |
| 5329 | > (BUF_Z (b) - BUF_BEG (b)) * 13) | 5330 | > (BUF_Z (b) - BUF_BEG (b)) * 13) |
| 5330 | /* A short file is likely to change a large fraction; | 5331 | /* A short file is likely to change a large fraction; |
| @@ -5345,14 +5346,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5345 | Fsleep_for (make_number (1), Qnil); | 5346 | Fsleep_for (make_number (1), Qnil); |
| 5346 | continue; | 5347 | continue; |
| 5347 | } | 5348 | } |
| 5348 | set_buffer_internal (b); | ||
| 5349 | if (!auto_saved && NILP (no_message)) | 5349 | if (!auto_saved && NILP (no_message)) |
| 5350 | message1 ("Auto-saving..."); | 5350 | message1 ("Auto-saving..."); |
| 5351 | internal_condition_case (auto_save_1, Qt, auto_save_error); | 5351 | internal_condition_case (auto_save_1, Qt, auto_save_error); |
| 5352 | auto_saved++; | 5352 | auto_saved++; |
| 5353 | b->auto_save_modified = BUF_MODIFF (b); | 5353 | b->auto_save_modified = BUF_MODIFF (b); |
| 5354 | if (XINT (current_buffer->save_length) != -2) | 5354 | XSETFASTINT (current_buffer->save_length, Z - BEG); |
| 5355 | XSETFASTINT (current_buffer->save_length, Z - BEG); | ||
| 5356 | set_buffer_internal (old); | 5355 | set_buffer_internal (old); |
| 5357 | 5356 | ||
| 5358 | EMACS_GET_TIME (after_time); | 5357 | EMACS_GET_TIME (after_time); |
| @@ -5397,8 +5396,7 @@ No auto-save file will be written until the buffer changes again. */) | |||
| 5397 | () | 5396 | () |
| 5398 | { | 5397 | { |
| 5399 | current_buffer->auto_save_modified = MODIFF; | 5398 | current_buffer->auto_save_modified = MODIFF; |
| 5400 | if (XINT (current_buffer->save_length) != -2) | 5399 | XSETFASTINT (current_buffer->save_length, Z - BEG); |
| 5401 | XSETFASTINT (current_buffer->save_length, Z - BEG); | ||
| 5402 | current_buffer->auto_save_failure_time = -1; | 5400 | current_buffer->auto_save_failure_time = -1; |
| 5403 | return Qnil; | 5401 | return Qnil; |
| 5404 | } | 5402 | } |
| @@ -5710,6 +5708,13 @@ a non-nil value. */); | |||
| 5710 | Normally auto-save files are written under other names. */); | 5708 | Normally auto-save files are written under other names. */); |
| 5711 | Vauto_save_visited_file_name = Qnil; | 5709 | Vauto_save_visited_file_name = Qnil; |
| 5712 | 5710 | ||
| 5711 | DEFVAR_LISP ("auto-save-include-big-deletions", &Vauto_save_include_big_deletions, | ||
| 5712 | doc: /* If non-nil, auto-save even if a large part of the text is deleted. | ||
| 5713 | If nil, deleting a substantial portion of the text disables auto-save | ||
| 5714 | in the buffer; this is the default behavior, because the auto-save | ||
| 5715 | file is usually more useful if it contains the deleted text. */); | ||
| 5716 | Vauto_save_include_big_deletions = Qnil; | ||
| 5717 | |||
| 5713 | #ifdef HAVE_FSYNC | 5718 | #ifdef HAVE_FSYNC |
| 5714 | DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync, | 5719 | DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync, |
| 5715 | doc: /* *Non-nil means don't call fsync in `write-region'. | 5720 | doc: /* *Non-nil means don't call fsync in `write-region'. |