150 |
/* List of functions to call that can query about killing a buffer. |
/* List of functions to call that can query about killing a buffer. |
151 |
If any of these functions returns nil, we don't kill it. */ |
If any of these functions returns nil, we don't kill it. */ |
152 |
Lisp_Object Vkill_buffer_query_functions; |
Lisp_Object Vkill_buffer_query_functions; |
153 |
|
Lisp_Object Qkill_buffer_query_functions; |
154 |
|
|
155 |
/* List of functions to call before changing an unmodified buffer. */ |
/* List of functions to call before changing an unmodified buffer. */ |
156 |
Lisp_Object Vfirst_change_hook; |
Lisp_Object Vfirst_change_hook; |
1305 |
{ |
{ |
1306 |
int count = SPECPDL_INDEX (); |
int count = SPECPDL_INDEX (); |
1307 |
Lisp_Object list; |
Lisp_Object list; |
1308 |
|
Lisp_Object arglist[1]; |
1309 |
|
|
1310 |
record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
1311 |
set_buffer_internal (b); |
set_buffer_internal (b); |
1312 |
|
|
1313 |
/* First run the query functions; if any query is answered no, |
/* First run the query functions; if any query is answered no, |
1314 |
don't kill the buffer. */ |
don't kill the buffer. */ |
1315 |
for (list = Vkill_buffer_query_functions; CONSP (list); list = XCDR (list)) |
arglist[0] = Qkill_buffer_query_functions; |
1316 |
{ |
if (NILP (Frun_hook_with_args_until_failure (1, arglist))) |
1317 |
tem = call0 (XCAR (list)); |
return unbind_to (count, Qnil); |
|
if (NILP (tem)) |
|
|
return unbind_to (count, Qnil); |
|
|
} |
|
1318 |
|
|
1319 |
/* Then run the hooks. */ |
/* Then run the hooks. */ |
1320 |
Frun_hooks (1, &Qkill_buffer_hook); |
Frun_hooks (1, &Qkill_buffer_hook); |
5150 |
staticpro (&Qafter_change_functions); |
staticpro (&Qafter_change_functions); |
5151 |
staticpro (&Qucs_set_table_for_input); |
staticpro (&Qucs_set_table_for_input); |
5152 |
|
|
5153 |
|
Qkill_buffer_query_functions = intern ("kill-buffer-query-functions"); |
5154 |
|
staticpro (&Qkill_buffer_query_functions); |
5155 |
|
|
5156 |
Fput (Qprotected_field, Qerror_conditions, |
Fput (Qprotected_field, Qerror_conditions, |
5157 |
Fcons (Qprotected_field, Fcons (Qerror, Qnil))); |
Fcons (Qprotected_field, Fcons (Qerror, Qnil))); |
5158 |
Fput (Qprotected_field, Qerror_message, |
Fput (Qprotected_field, Qerror_message, |