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

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents fe104dbd9147
children 9f59509498e1
comparison
equal deleted inserted replaced
113:2ec2fe4a4c89 114:8619ce7e4c50
984 int already = BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf); 984 int already = BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf);
985 if (already == NILP (flag)) 985 if (already == NILP (flag))
986 { 986 {
987 int count = specpdl_depth (); 987 int count = specpdl_depth ();
988 /* lock_file() and unlock_file() currently use current_buffer */ 988 /* lock_file() and unlock_file() currently use current_buffer */
989 /* #### - dmoore, what if lock_file or unlock_file kill
990 the current buffer? */
989 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 991 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
990 set_buffer_internal (buf); 992 set_buffer_internal (buf);
991 if (!already && !NILP (flag)) 993 if (!already && !NILP (flag))
992 lock_file (fn); 994 lock_file (fn);
993 else if (already && NILP (flag)) 995 else if (already && NILP (flag))
1304 1306
1305 /* We have no more questions to ask. Verify that it is valid 1307 /* We have no more questions to ask. Verify that it is valid
1306 to kill the buffer. This must be done after the questions 1308 to kill the buffer. This must be done after the questions
1307 since anything can happen within yes-or-no-p. */ 1309 since anything can happen within yes-or-no-p. */
1308 1310
1311 /* Might have been deleted during the last question above */
1312 if (!BUFFER_LIVE_P (b))
1313 return Qnil;
1314
1309 /* Don't kill the minibuffer now current. */ 1315 /* Don't kill the minibuffer now current. */
1310 if (EQ (buf, XWINDOW (minibuf_window)->buffer)) 1316 if (EQ (buf, XWINDOW (minibuf_window)->buffer))
1311 return Qnil;
1312
1313 /* Might have been deleted during the last question above */
1314 if (!BUFFER_LIVE_P (b))
1315 return Qnil; 1317 return Qnil;
1316 1318
1317 /* When we kill a base buffer, kill all its indirect buffers. 1319 /* When we kill a base buffer, kill all its indirect buffers.
1318 We do it at this stage so nothing terrible happens if they 1320 We do it at this stage so nothing terrible happens if they
1319 ask questions or their hooks get errors. */ 1321 ask questions or their hooks get errors. */
1340 } 1342 }
1341 1343
1342 /* Now there is no question: we can kill the buffer. */ 1344 /* Now there is no question: we can kill the buffer. */
1343 1345
1344 #ifdef CLASH_DETECTION 1346 #ifdef CLASH_DETECTION
1345 /* Unlock this buffer's file, if it is locked. */ 1347 /* Unlock this buffer's file, if it is locked. unlock_buffer
1348 can both GC and kill the current buffer, and wreak general
1349 havok by running lisp code. */
1350 GCPRO1 (buf);
1346 unlock_buffer (b); 1351 unlock_buffer (b);
1352 UNGCPRO;
1353 b = XBUFFER (buf);
1354
1355 if (!BUFFER_LIVE_P (b))
1356 return Qnil;
1357
1358 if (b == current_buffer)
1359 {
1360 Fset_buffer (Fother_buffer (buf, Qnil, Qnil));
1361 if (b == current_buffer)
1362 return Qnil;
1363 }
1347 #endif /* CLASH_DETECTION */ 1364 #endif /* CLASH_DETECTION */
1348 1365
1349 { 1366 {
1350 int speccount = specpdl_depth (); 1367 int speccount = specpdl_depth ();
1351 specbind (Qinhibit_quit, Qt); 1368 specbind (Qinhibit_quit, Qt);