Mercurial > emacs
comparison src/buffer.c @ 108396:842d29bdc9a5
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Wed, 13 Jan 2010 14:05:08 +0000 |
parents | 4040ecb0c904 |
children | cdeadbfdda61 c5f9e4613394 |
comparison
equal
deleted
inserted
replaced
108395:e36c1160a378 | 108396:842d29bdc9a5 |
---|---|
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 |
7 This file is part of GNU Emacs. | 7 This file is part of GNU Emacs. |
8 | 8 |
9 GNU Emacs is free software: you can redistribute it and/or modify | 9 GNU Emacs is free software: you can redistribute it and/or modify |
702 b->last_window_start = 1; | 702 b->last_window_start = 1; |
703 /* It is more conservative to start out "changed" than "unchanged". */ | 703 /* It is more conservative to start out "changed" than "unchanged". */ |
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; |
711 b->overlays_before = NULL; | 711 b->overlays_before = NULL; |
712 b->overlays_after = NULL; | 712 b->overlays_after = NULL; |
1130 else if (already && NILP (flag)) | 1130 else if (already && NILP (flag)) |
1131 unlock_file (fn); | 1131 unlock_file (fn); |
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 |
1139 state by recording/restoring the state around blocks of code. | 1157 state by recording/restoring the state around blocks of code. |
1140 Setting update_mode_lines makes redisplay consider all windows | 1158 Setting update_mode_lines makes redisplay consider all windows |
1539 Vinhibit_quit = tem; | 1557 Vinhibit_quit = tem; |
1540 | 1558 |
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 { |
1549 Lisp_Object tem; | 1567 Lisp_Object tem; |
1550 tem = Fsymbol_value (intern ("delete-auto-save-files")); | 1568 tem = Fsymbol_value (intern ("delete-auto-save-files")); |