diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2009-07-21 23:17:06 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2009-07-21 23:17:06 +0000 |
commit | e3a722e03b7547a738742beebb607d1c9c61c5d9 (patch) | |
tree | 901b98dff0e57d10da05221ca26bf7716a2b2f62 | |
parent | c48cbceb0ba8c4726787206b93a76bed5d3343a3 (diff) | |
download | emacs-e3a722e03b7547a738742beebb607d1c9c61c5d9.tar.gz |
* fileio.c (Vauto_save_include_big_deletions): New variable.
(Fdo_auto_save): Disable auto-save only if
auto-save-include-big-deletions is nil.
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/fileio.c | 17 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1ed4b48e3ca..c84ed27d87b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2009-07-21 Chong Yidong <cyd@stupidchicken.com> + * fileio.c (Vauto_save_include_big_deletions): New variable. + (Fdo_auto_save): Disable auto-save only if + auto-save-include-big-deletions is nil. + +2009-07-21 Chong Yidong <cyd@stupidchicken.com> + * xdisp.c (move_it_to): For continued lines ending in a tab, take the overflowed pixels into account (Bug#3879). diff --git a/src/fileio.c b/src/fileio.c index bf96b3aa2b1..3702d4cc1b8 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -193,6 +193,9 @@ Lisp_Object Vauto_save_list_file_name; /* Whether or not files are auto-saved into themselves. */ Lisp_Object Vauto_save_visited_file_name; +/* Whether or not to continue auto-saving after a large deletion. */ +Lisp_Object Vauto_save_include_big_deletions; + /* On NT, specifies the directory separator character, used (eg.) when expanding file names. This can be bound to / or \. */ Lisp_Object Vdirectory_sep_char; @@ -5321,8 +5324,10 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) continue; - if ((XFASTINT (b->save_length) * 10 - > (BUF_Z (b) - BUF_BEG (b)) * 13) + set_buffer_internal (b); + if (NILP (Vauto_save_include_big_deletions) + && (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 @@ -5341,7 +5346,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) Fsleep_for (make_number (1), Qnil); continue; } - set_buffer_internal (b); if (!auto_saved && NILP (no_message)) message1 ("Auto-saving..."); internal_condition_case (auto_save_1, Qt, auto_save_error); @@ -5704,6 +5708,13 @@ a non-nil value. */); Normally auto-save files are written under other names. */); Vauto_save_visited_file_name = Qnil; + DEFVAR_LISP ("auto-save-include-big-deletions", &Vauto_save_include_big_deletions, + doc: /* If non-nil, auto-save even if a large part of the text is deleted. +If nil, deleting a substantial portion of the text disables auto-save +in the buffer; this is the default behavior, because the auto-save +file is usually more useful if it contains the deleted text. */); + Vauto_save_include_big_deletions = Qnil; + #ifdef HAVE_FSYNC DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync, doc: /* *Non-nil means don't call fsync in `write-region'. |