Mercurial > emacs
diff src/fileio.c @ 106813:4040ecb0c904
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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 12 Jan 2010 23:33:42 -0500 |
parents | f2cea199b0c4 |
children | 8b0707b50290 |
line wrap: on
line diff
--- a/src/fileio.c Wed Jan 13 10:40:39 2010 +0900 +++ b/src/fileio.c Tue Jan 12 23:33:42 2010 -0500 @@ -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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 */