diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-01-12 23:33:42 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-01-12 23:33:42 -0500 |
commit | 0b5397c27163729ca48af4d0c569e574638be2d1 (patch) | |
tree | 626dd46c422a029de0664b2be4a625460663f463 /src/fileio.c | |
parent | d1bf28dc12ef1a0f3cecbf78f38795db27b38574 (diff) | |
download | emacs-0b5397c27163729ca48af4d0c569e574638be2d1.tar.gz emacs-0b5397c27163729ca48af4d0c569e574638be2d1.tar.bz2 emacs-0b5397c27163729ca48af4d0c569e574638be2d1.zip |
Try to fix bug#5314. This is probably not the final word, tho.
* buffer.c (Fset_buffer_modified_p): Try and be careful not to modify
recent-auto-save-p as a side-effect.
* buffer.h (BUF_AUTOSAVE_MODIFF): New macro.
* buffer.c (Fkill_buffer, reset_buffer):
* editfns.c (Fsubst_char_in_region):
* fileio.c (Finsert_file_contents, Fdo_auto_save)
(Fset_buffer_auto_saved, Frecent_auto_save_p): Use it.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/fileio.c b/src/fileio.c index b815c38956e..d6cb814641b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1,7 +1,7 @@ /* File IO for GNU Emacs. Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -4097,7 +4097,7 @@ variable `last-coding-system-used' to the coding system actually used. */) } SAVE_MODIFF = MODIFF; - current_buffer->auto_save_modified = MODIFF; + BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; XSETFASTINT (current_buffer->save_length, Z - BEG); #ifdef CLASH_DETECTION if (NILP (handler)) @@ -5307,7 +5307,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) and file changed since last real save. */ if (STRINGP (b->auto_save_file_name) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) - && b->auto_save_modified < BUF_MODIFF (b) + && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) /* -1 means we've turned off autosaving for a while--see below. */ && XINT (b->save_length) >= 0 && (do_handled_files @@ -5349,7 +5349,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) message1 ("Auto-saving..."); internal_condition_case (auto_save_1, Qt, auto_save_error); auto_saved++; - b->auto_save_modified = BUF_MODIFF (b); + BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b); XSETFASTINT (current_buffer->save_length, Z - BEG); set_buffer_internal (old); @@ -5394,7 +5394,9 @@ DEFUN ("set-buffer-auto-saved", Fset_buffer_auto_saved, No auto-save file will be written until the buffer changes again. */) () { - current_buffer->auto_save_modified = MODIFF; + /* FIXME: This should not be called in indirect buffers, since + they're not autosaved. */ + BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; XSETFASTINT (current_buffer->save_length, Z - BEG); current_buffer->auto_save_failure_time = -1; return Qnil; @@ -5417,7 +5419,9 @@ in the visited file. If the buffer has no visited file, then any auto-save counts as "recent". */) () { - return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil; + /* FIXME: maybe we should return nil for indirect buffers since + they're never autosaved. */ + return (SAVE_MODIFF < BUF_AUTOSAVE_MODIFF (current_buffer) ? Qt : Qnil); } /* Reading and completing file names */ |