comparison src/insdel.c @ 114:8619ce7e4c50 r20-1b9

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents 0d2f883870bc
children cca96a509cfe
comparison
equal deleted inserted replaced
113:2ec2fe4a4c89 114:8619ce7e4c50
2273 static void 2273 static void
2274 prepare_to_modify_buffer (struct buffer *buf, Bufpos start, Bufpos end, 2274 prepare_to_modify_buffer (struct buffer *buf, Bufpos start, Bufpos end,
2275 int lockit) 2275 int lockit)
2276 { 2276 {
2277 /* This function can GC */ 2277 /* This function can GC */
2278 /* dmoore - This function can also kill the buffer buf, the current
2279 buffer, and do anything it pleases. So if you call it, be
2280 careful. */
2281 Lisp_Object buffer;
2282 struct gcpro gcpro1;
2283
2278 barf_if_buffer_read_only (buf, start, end); 2284 barf_if_buffer_read_only (buf, start, end);
2279 2285
2280 /* if this is the first modification, see about locking the buffer's 2286 /* if this is the first modification, see about locking the buffer's
2281 file */ 2287 file */
2288 XSETBUFFER (buffer, buf);
2289 GCPRO1 (buffer);
2282 if (!NILP (buf->filename) && lockit && 2290 if (!NILP (buf->filename) && lockit &&
2283 BUF_SAVE_MODIFF (buf) >= BUF_MODIFF (buf)) 2291 BUF_SAVE_MODIFF (buf) >= BUF_MODIFF (buf))
2284 { 2292 {
2285 #ifdef CLASH_DETECTION 2293 #ifdef CLASH_DETECTION
2286 if (!NILP (buf->file_truename)) 2294 if (!NILP (buf->file_truename))
2287 /* Make binding buffer-file-name to nil effective. */ 2295 /* Make binding buffer-file-name to nil effective. */
2288 lock_file (buf->file_truename); 2296 lock_file (buf->file_truename);
2289 #else 2297 #else
2290 Lisp_Object buffer;
2291 XSETBUFFER (buffer, buf);
2292 /* At least warn if this file has changed on disk since it was visited.*/ 2298 /* At least warn if this file has changed on disk since it was visited.*/
2293 if (NILP (Fverify_visited_file_modtime (buffer)) 2299 if (NILP (Fverify_visited_file_modtime (buffer))
2294 && !NILP (Ffile_exists_p (buf->filename))) 2300 && !NILP (Ffile_exists_p (buf->filename)))
2295 call1_in_buffer (buf, intern ("ask-user-about-supersession-threat"), 2301 call1_in_buffer (buf, intern ("ask-user-about-supersession-threat"),
2296 buf->filename); 2302 buf->filename);
2297 #endif /* not CLASH_DETECTION */ 2303 #endif /* not CLASH_DETECTION */
2298 } 2304 }
2305 UNGCPRO;
2306
2307 /* #### dmoore - is this reasonable in case of buf being killed above? */
2308 if (!BUFFER_LIVE_P (buf))
2309 return;
2299 2310
2300 signal_before_change (buf, start, end); 2311 signal_before_change (buf, start, end);
2301 2312
2302 #ifdef REGION_CACHE_NEEDS_WORK 2313 #ifdef REGION_CACHE_NEEDS_WORK
2303 if (buf->newline_cache) 2314 if (buf->newline_cache)