comparison src/buffer.c @ 217:d44af0c54775 r20-4b7

Import from CVS: tag r20-4b7
author cvs
date Mon, 13 Aug 2007 10:08:34 +0200
parents 78478c60bfcd
children 262b8bb4a523
comparison
equal deleted inserted replaced
216:43306a74e31c 217:d44af0c54775
214 they disappear, and the children removal happens then. */ 214 they disappear, and the children removal happens then. */
215 DEFINE_LRECORD_IMPLEMENTATION ("buffer", buffer, 215 DEFINE_LRECORD_IMPLEMENTATION ("buffer", buffer,
216 mark_buffer, print_buffer, 0, 0, 0, 216 mark_buffer, print_buffer, 0, 0, 0,
217 struct buffer); 217 struct buffer);
218 218
219 #ifdef ENERGIZE
220 extern void mark_energize_buffer_data (struct buffer *b,
221 void (*markobj) (Lisp_Object));
222 #endif
223
224 Lisp_Object 219 Lisp_Object
225 make_buffer (struct buffer *buf) 220 make_buffer (struct buffer *buf)
226 { 221 {
227 Lisp_Object obj; 222 Lisp_Object obj;
228 XSETBUFFER (obj, buf); 223 XSETBUFFER (obj, buf);
240 undo_high_threshold); 235 undo_high_threshold);
241 236
242 #define MARKED_SLOT(x) ((markobj) (buf->x)); 237 #define MARKED_SLOT(x) ((markobj) (buf->x));
243 #include "bufslots.h" 238 #include "bufslots.h"
244 #undef MARKED_SLOT 239 #undef MARKED_SLOT
245
246 #ifdef ENERGIZE
247 mark_energize_buffer_data (XBUFFER (obj), markobj);
248 #endif
249 240
250 ((markobj) (buf->extent_info)); 241 ((markobj) (buf->extent_info));
251 242
252 /* Don't mark normally through the children slot. 243 /* Don't mark normally through the children slot.
253 (Actually, in this case, it doesn't matter.) 244 (Actually, in this case, it doesn't matter.)
957 (flag, buffer)) 948 (flag, buffer))
958 { 949 {
959 /* This function can GC */ 950 /* This function can GC */
960 struct buffer *buf = decode_buffer (buffer, 0); 951 struct buffer *buf = decode_buffer (buffer, 0);
961 952
962 #ifdef ENERGIZE
963 Lisp_Object starting_flag =
964 (BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf)) ? Qt : Qnil;
965 Lisp_Object argument_flag = (NILP (flag)) ? Qnil : Qt;
966 #endif
967
968 #ifdef CLASH_DETECTION 953 #ifdef CLASH_DETECTION
969 /* If buffer becoming modified, lock the file. 954 /* If buffer becoming modified, lock the file.
970 If buffer becoming unmodified, unlock the file. */ 955 If buffer becoming unmodified, unlock the file. */
971 956
972 Lisp_Object fn = buf->file_truename; 957 Lisp_Object fn = buf->file_truename;
997 work. */ 982 work. */
998 buf = decode_buffer(buffer, 0); 983 buf = decode_buffer(buffer, 0);
999 BUF_MODIFF (buf)++; 984 BUF_MODIFF (buf)++;
1000 BUF_SAVE_MODIFF (buf) = NILP (flag) ? BUF_MODIFF (buf) : 0; 985 BUF_SAVE_MODIFF (buf) = NILP (flag) ? BUF_MODIFF (buf) : 0;
1001 MARK_MODELINE_CHANGED; 986 MARK_MODELINE_CHANGED;
1002
1003 #ifdef ENERGIZE
1004 /* don't send any notification if we are "setting" the modification bit
1005 to be the same as it already was */
1006 if (!EQ (starting_flag, argument_flag))
1007 {
1008 extern Lisp_Object Qenergize_buffer_modified_hook;
1009 int count = specpdl_depth ();
1010 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
1011 set_buffer_internal (buf);
1012 va_run_hook_with_args (Qenergize_buffer_modified_hook, 3,
1013 flag, make_int (BUF_BEG (buf)),
1014 make_int (BUF_Z (buf)));
1015 unbind_to (count, Qnil);
1016 }
1017 #endif /* ENERGIZE */
1018 987
1019 return flag; 988 return flag;
1020 } 989 }
1021 990
1022 DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, 0, 1, 0, /* 991 DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, 0, 1, 0, /*