Mercurial > hg > xemacs-beta
comparison src/buffer.c @ 40:7e54bd776075 r19-15b103
Import from CVS: tag r19-15b103
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:54:25 +0200 |
parents | e04119814345 |
children | 8d2a9b52c682 |
comparison
equal
deleted
inserted
replaced
39:06f275776fba | 40:7e54bd776075 |
---|---|
978 int already = BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf); | 978 int already = BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf); |
979 if (already == NILP (flag)) | 979 if (already == NILP (flag)) |
980 { | 980 { |
981 int count = specpdl_depth (); | 981 int count = specpdl_depth (); |
982 /* lock_file() and unlock_file() currently use current_buffer */ | 982 /* lock_file() and unlock_file() currently use current_buffer */ |
983 /* #### - dmoore, what if lock_file or unlock_file kill | |
984 the current buffer? */ | |
983 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 985 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
984 set_buffer_internal (buf); | 986 set_buffer_internal (buf); |
985 if (!already && !NILP (flag)) | 987 if (!already && !NILP (flag)) |
986 lock_file (fn); | 988 lock_file (fn); |
987 else if (already && NILP (flag)) | 989 else if (already && NILP (flag)) |
1298 | 1300 |
1299 /* We have no more questions to ask. Verify that it is valid | 1301 /* We have no more questions to ask. Verify that it is valid |
1300 to kill the buffer. This must be done after the questions | 1302 to kill the buffer. This must be done after the questions |
1301 since anything can happen within yes-or-no-p. */ | 1303 since anything can happen within yes-or-no-p. */ |
1302 | 1304 |
1305 /* Might have been deleted during the last question above */ | |
1306 if (!BUFFER_LIVE_P (b)) | |
1307 return Qnil; | |
1308 | |
1303 /* Don't kill the minibuffer now current. */ | 1309 /* Don't kill the minibuffer now current. */ |
1304 if (EQ (buf, XWINDOW (minibuf_window)->buffer)) | 1310 if (EQ (buf, XWINDOW (minibuf_window)->buffer)) |
1305 return Qnil; | |
1306 | |
1307 /* Might have been deleted during the last question above */ | |
1308 if (!BUFFER_LIVE_P (b)) | |
1309 return Qnil; | 1311 return Qnil; |
1310 | 1312 |
1311 /* When we kill a base buffer, kill all its indirect buffers. | 1313 /* When we kill a base buffer, kill all its indirect buffers. |
1312 We do it at this stage so nothing terrible happens if they | 1314 We do it at this stage so nothing terrible happens if they |
1313 ask questions or their hooks get errors. */ | 1315 ask questions or their hooks get errors. */ |
1334 } | 1336 } |
1335 | 1337 |
1336 /* Now there is no question: we can kill the buffer. */ | 1338 /* Now there is no question: we can kill the buffer. */ |
1337 | 1339 |
1338 #ifdef CLASH_DETECTION | 1340 #ifdef CLASH_DETECTION |
1339 /* Unlock this buffer's file, if it is locked. */ | 1341 /* Unlock this buffer's file, if it is locked. unlock_buffer |
1342 can both GC and kill the current buffer, and wreak general | |
1343 havok by running lisp code. */ | |
1344 GCPRO1 (buf); | |
1340 unlock_buffer (b); | 1345 unlock_buffer (b); |
1346 UNGCPRO; | |
1347 b = XBUFFER (buf); | |
1348 | |
1349 if (!BUFFER_LIVE_P (b)) | |
1350 return Qnil; | |
1351 | |
1352 if (b == current_buffer) | |
1353 { | |
1354 Fset_buffer (Fother_buffer (buf, Qnil, Qnil)); | |
1355 if (b == current_buffer) | |
1356 return Qnil; | |
1357 } | |
1341 #endif /* CLASH_DETECTION */ | 1358 #endif /* CLASH_DETECTION */ |
1342 | 1359 |
1343 { | 1360 { |
1344 int speccount = specpdl_depth (); | 1361 int speccount = specpdl_depth (); |
1345 specbind (Qinhibit_quit, Qt); | 1362 specbind (Qinhibit_quit, Qt); |