aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2010-01-12 23:33:42 -0500
committerStefan Monnier2010-01-12 23:33:42 -0500
commit0b5397c27163729ca48af4d0c569e574638be2d1 (patch)
tree626dd46c422a029de0664b2be4a625460663f463 /src
parentd1bf28dc12ef1a0f3cecbf78f38795db27b38574 (diff)
downloademacs-0b5397c27163729ca48af4d0c569e574638be2d1.tar.gz
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')
-rw-r--r--src/ChangeLog33
-rw-r--r--src/buffer.c28
-rw-r--r--src/buffer.h6
-rw-r--r--src/editfns.c6
-rw-r--r--src/fileio.c16
5 files changed, 63 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6e3fc4ff1c5..1ad107b566c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,17 +1,28 @@
12010-01-13 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 Try to fix bug#5314. This is probably not the final word, tho.
4 * buffer.c (Fset_buffer_modified_p): Try and be careful not to modify
5 recent-auto-save-p as a side-effect.
6 * buffer.h (BUF_AUTOSAVE_MODIFF): New macro.
7 * buffer.c (Fkill_buffer, reset_buffer):
8 * editfns.c (Fsubst_char_in_region):
9 * fileio.c (Finsert_file_contents, Fdo_auto_save)
10 (Fset_buffer_auto_saved, Frecent_auto_save_p): Use it.
11
12010-01-13 Kenichi Handa <handa@m17n.org> 122010-01-13 Kenichi Handa <handa@m17n.org>
2 13
3 Display buffer name, etc. in mode line by composing correctly. 14 Display buffer name, etc. in mode line by composing correctly.
4 15
5 * xdisp.c (reseat_to_string): Call composition_compute_stop_pos if 16 * xdisp.c (reseat_to_string): Call composition_compute_stop_pos if
6 STRING is not nil. 17 STRING is not nil.
7 (display_mode_element): Adjusted for the change of 18 (display_mode_element): Adjust for the change of
8 decode_mode_spec and display_line. 19 decode_mode_spec and display_line.
9 (decode_mode_spec): Change arg MULTIBYTE to STRING. 20 (decode_mode_spec): Change arg MULTIBYTE to STRING.
10 (display_string): Handle the case that STRING is non-null and 21 (display_string): Handle the case that STRING is non-null and
11 LISP_STRING is not nil. 22 LISP_STRING is not nil.
12 23
13 * xterm.c (x_draw_composite_glyph_string_foreground): Pay 24 * xterm.c (x_draw_composite_glyph_string_foreground):
14 attention to s->face->overstrike. 25 Pay attention to s->face->overstrike.
15 26
16 * composite.c (composition_reseat_it): Don't check PT if STRING is 27 * composite.c (composition_reseat_it): Don't check PT if STRING is
17 non nil. 28 non nil.
@@ -125,8 +136,8 @@
125 (x_set_window_size): ... to here. bug #2568. 136 (x_set_window_size): ... to here. bug #2568.
126 137
127 * gtkutil.c (xg_clear_under_internal_border): New function. 138 * gtkutil.c (xg_clear_under_internal_border): New function.
128 (xg_frame_resized, xg_frame_set_char_size): Call 139 (xg_frame_resized, xg_frame_set_char_size):
129 xg_clear_under_internal_border. 140 Call xg_clear_under_internal_border.
130 (xg_update_scrollbar_pos): Clear under old scroll bar position. 141 (xg_update_scrollbar_pos): Clear under old scroll bar position.
131 142
1322010-01-05 Chong Yidong <cyd@stupidchicken.com> 1432010-01-05 Chong Yidong <cyd@stupidchicken.com>
@@ -250,8 +261,8 @@
250 and atimer.h. 261 and atimer.h.
251 (minibuf.o): Depend on systime.h and coding.h. Don't depend on 262 (minibuf.o): Depend on systime.h and coding.h. Don't depend on
252 dispextern.h explicitly. 263 dispextern.h explicitly.
253 (print.o): Depend on termhooks.h, coding.h, and ccl.h. Don't 264 (print.o): Depend on termhooks.h, coding.h, and ccl.h.
254 depend explicitly on dispextern.h and composite.h. 265 Don't depend explicitly on dispextern.h and composite.h.
255 (process.o): Depend on character.h, xgselect.h, and sysselect.h. 266 (process.o): Depend on character.h, xgselect.h, and sysselect.h.
256 (regex.o): Don't depend on charset.h. 267 (regex.o): Don't depend on charset.h.
257 (scroll.o): Depend on systime.h, coding.h, composite.h, and window.h. 268 (scroll.o): Depend on systime.h, coding.h, composite.h, and window.h.
@@ -430,8 +441,8 @@
430 441
4312009-12-04 Eli Zaretskii <eliz@gnu.org> 4422009-12-04 Eli Zaretskii <eliz@gnu.org>
432 443
433 * dispextern.h (enum prop_idx) <AUTO_COMPOSED_PROP_IDX>: Delete 444 * dispextern.h (enum prop_idx) <AUTO_COMPOSED_PROP_IDX>:
434 unused enumeration value. 445 Delete unused enumeration value.
435 446
4362009-12-03 Eli Zaretskii <eliz@gnu.org> 4472009-12-03 Eli Zaretskii <eliz@gnu.org>
437 448
@@ -562,8 +573,8 @@
562 573
5632009-11-21 Andreas Schwab <schwab@linux-m68k.org> 5742009-11-21 Andreas Schwab <schwab@linux-m68k.org>
564 575
565 * character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove 576 * character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH):
566 ignored second argument. All callers changed. 577 Remove ignored second argument. All callers changed.
567 * regex.c (STRING_CHAR, STRING_CHAR_AND_LENGTH, RE_STRING_CHAR) 578 * regex.c (STRING_CHAR, STRING_CHAR_AND_LENGTH, RE_STRING_CHAR)
568 (RE_STRING_CHAR_AND_LENGTH): Likewise. 579 (RE_STRING_CHAR_AND_LENGTH): Likewise.
569 * xdisp.c (string_char_and_length): Likewise. 580 * xdisp.c (string_char_and_length): Likewise.
diff --git a/src/buffer.c b/src/buffer.c
index 8657fd8cdff..1880581c0a1 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,7 +1,7 @@
1/* Buffer manipulation primitives for GNU Emacs. 1/* Buffer manipulation primitives for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 2 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994,
3 1995, 1997, 1998, 1999, 2000, 2001, 2002, 3 1995, 1997, 1998, 1999, 2000, 2001, 2002,
4 2003, 2004, 2005, 2006, 2007, 2008, 2009 4 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc. 5 Free Software Foundation, Inc.
6 6
7This file is part of GNU Emacs. 7This file is part of GNU Emacs.
@@ -704,7 +704,7 @@ reset_buffer (b)
704 b->clip_changed = 0; 704 b->clip_changed = 0;
705 b->prevent_redisplay_optimizations_p = 1; 705 b->prevent_redisplay_optimizations_p = 1;
706 b->backed_up = Qnil; 706 b->backed_up = Qnil;
707 b->auto_save_modified = 0; 707 BUF_AUTOSAVE_MODIFF (b) = 0;
708 b->auto_save_failure_time = -1; 708 b->auto_save_failure_time = -1;
709 b->auto_save_file_name = Qnil; 709 b->auto_save_file_name = Qnil;
710 b->read_only = Qnil; 710 b->read_only = Qnil;
@@ -1132,7 +1132,25 @@ A non-nil FLAG means mark the buffer modified. */)
1132 } 1132 }
1133#endif /* CLASH_DETECTION */ 1133#endif /* CLASH_DETECTION */
1134 1134
1135 SAVE_MODIFF = NILP (flag) ? MODIFF : 0; 1135 /* Here we have a problem. SAVE_MODIFF is used here to encode
1136 buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as
1137 recent-auto-save-p (as SAVE_MODIFF<auto_save_modified). So if we
1138 modify SAVE_MODIFF to affect one, we may affect the other
1139 as well.
1140 E.g. if FLAG is nil we need to set SAVE_MODIFF to MODIFF, but
1141 if SAVE_MODIFF<auto_save_modified that means we risk changing
1142 recent-auto-save-p from t to nil.
1143 Vice versa, if FLAG is non-nil and SAVE_MODIFF>=auto_save_modified
1144 we risk changing recent-auto-save-p from nil to t. */
1145 SAVE_MODIFF = (NILP (flag)
1146 /* FIXME: This unavoidably sets recent-auto-save-p to nil. */
1147 ? MODIFF
1148 /* Let's try to preserve recent-auto-save-p. */
1149 : SAVE_MODIFF < MODIFF ? SAVE_MODIFF
1150 /* If SAVE_MODIFF == auto_save_modified == MODIFF,
1151 we can either decrease SAVE_MODIFF and auto_save_modified
1152 or increase MODIFF. */
1153 : MODIFF++);
1136 1154
1137 /* Set update_mode_lines only if buffer is displayed in some window. 1155 /* Set update_mode_lines only if buffer is displayed in some window.
1138 Packages like jit-lock or lazy-lock preserve a buffer's modified 1156 Packages like jit-lock or lazy-lock preserve a buffer's modified
@@ -1541,8 +1559,8 @@ with SIGHUP. */)
1541 /* Delete any auto-save file, if we saved it in this session. 1559 /* Delete any auto-save file, if we saved it in this session.
1542 But not if the buffer is modified. */ 1560 But not if the buffer is modified. */
1543 if (STRINGP (b->auto_save_file_name) 1561 if (STRINGP (b->auto_save_file_name)
1544 && b->auto_save_modified != 0 1562 && BUF_AUTOSAVE_MODIFF (b) != 0
1545 && BUF_SAVE_MODIFF (b) < b->auto_save_modified 1563 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b)
1546 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 1564 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
1547 && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) 1565 && NILP (Fsymbol_value (intern ("auto-save-visited-file-name"))))
1548 { 1566 {
diff --git a/src/buffer.h b/src/buffer.h
index 9f57a292053..5217c6d7298 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,6 +1,6 @@
1/* Header file for the buffer manipulation primitives. 1/* Header file for the buffer manipulation primitives.
2 Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2 Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
@@ -158,6 +158,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
158/* Overlay modification count. */ 158/* Overlay modification count. */
159#define BUF_OVERLAY_MODIFF(buf) ((buf)->text->overlay_modiff) 159#define BUF_OVERLAY_MODIFF(buf) ((buf)->text->overlay_modiff)
160 160
161/* Modification count as of last auto-save. */
162/* FIXME: should we move this into ->text->auto_save_modiff? */
163#define BUF_AUTOSAVE_MODIFF(buf) ((buf)->auto_save_modified)
164
161/* Interval tree of buffer. */ 165/* Interval tree of buffer. */
162#define BUF_INTERVALS(buf) ((buf)->text->intervals) 166#define BUF_INTERVALS(buf) ((buf)->text->intervals)
163 167
diff --git a/src/editfns.c b/src/editfns.c
index 58e13b1ed7c..00ac0ca0fa9 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1,7 +1,7 @@
1/* Lisp functions pertaining to editing. 1/* Lisp functions pertaining to editing.
2 Copyright (C) 1985, 1986, 1987, 1989, 1993, 1994, 1995, 1996, 2 Copyright (C) 1985, 1986, 1987, 1989, 1993, 1994, 1995, 1996,
3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 4 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -2870,8 +2870,8 @@ Both characters must have the same length of multi-byte form. */)
2870 { 2870 {
2871 if (MODIFF - 1 == SAVE_MODIFF) 2871 if (MODIFF - 1 == SAVE_MODIFF)
2872 SAVE_MODIFF++; 2872 SAVE_MODIFF++;
2873 if (MODIFF - 1 == current_buffer->auto_save_modified) 2873 if (MODIFF - 1 == BUF_AUTOSAVE_MODIFF (current_buffer))
2874 current_buffer->auto_save_modified++; 2874 BUF_AUTOSAVE_MODIFF (current_buffer)++;
2875 } 2875 }
2876 2876
2877 /* The before-change-function may have moved the gap 2877 /* The before-change-function may have moved the gap
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 @@
1/* File IO for GNU Emacs. 1/* File IO for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996,
3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 4 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -4097,7 +4097,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4097 } 4097 }
4098 4098
4099 SAVE_MODIFF = MODIFF; 4099 SAVE_MODIFF = MODIFF;
4100 current_buffer->auto_save_modified = MODIFF; 4100 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
4101 XSETFASTINT (current_buffer->save_length, Z - BEG); 4101 XSETFASTINT (current_buffer->save_length, Z - BEG);
4102#ifdef CLASH_DETECTION 4102#ifdef CLASH_DETECTION
4103 if (NILP (handler)) 4103 if (NILP (handler))
@@ -5307,7 +5307,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5307 and file changed since last real save. */ 5307 and file changed since last real save. */
5308 if (STRINGP (b->auto_save_file_name) 5308 if (STRINGP (b->auto_save_file_name)
5309 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 5309 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
5310 && b->auto_save_modified < BUF_MODIFF (b) 5310 && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b)
5311 /* -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. */
5312 && XINT (b->save_length) >= 0 5312 && XINT (b->save_length) >= 0
5313 && (do_handled_files 5313 && (do_handled_files
@@ -5349,7 +5349,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5349 message1 ("Auto-saving..."); 5349 message1 ("Auto-saving...");
5350 internal_condition_case (auto_save_1, Qt, auto_save_error); 5350 internal_condition_case (auto_save_1, Qt, auto_save_error);
5351 auto_saved++; 5351 auto_saved++;
5352 b->auto_save_modified = BUF_MODIFF (b); 5352 BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
5353 XSETFASTINT (current_buffer->save_length, Z - BEG); 5353 XSETFASTINT (current_buffer->save_length, Z - BEG);
5354 set_buffer_internal (old); 5354 set_buffer_internal (old);
5355 5355
@@ -5394,7 +5394,9 @@ DEFUN ("set-buffer-auto-saved", Fset_buffer_auto_saved,
5394No auto-save file will be written until the buffer changes again. */) 5394No auto-save file will be written until the buffer changes again. */)
5395 () 5395 ()
5396{ 5396{
5397 current_buffer->auto_save_modified = MODIFF; 5397 /* FIXME: This should not be called in indirect buffers, since
5398 they're not autosaved. */
5399 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
5398 XSETFASTINT (current_buffer->save_length, Z - BEG); 5400 XSETFASTINT (current_buffer->save_length, Z - BEG);
5399 current_buffer->auto_save_failure_time = -1; 5401 current_buffer->auto_save_failure_time = -1;
5400 return Qnil; 5402 return Qnil;
@@ -5417,7 +5419,9 @@ in the visited file. If the buffer has no visited file,
5417then any auto-save counts as "recent". */) 5419then any auto-save counts as "recent". */)
5418 () 5420 ()
5419{ 5421{
5420 return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil; 5422 /* FIXME: maybe we should return nil for indirect buffers since
5423 they're never autosaved. */
5424 return (SAVE_MODIFF < BUF_AUTOSAVE_MODIFF (current_buffer) ? Qt : Qnil);
5421} 5425}
5422 5426
5423/* Reading and completing file names */ 5427/* Reading and completing file names */