mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-16 09:50:25 +00:00
(Fkill_buffer): Use Frun_hook_with_args_until_failure
to run kill-buffer-query-functions. (Qkill_buffer_query_functions): New var. (syms_of_buffer): Init and staticpro it.
This commit is contained in:
parent
710ee5a968
commit
5b20caf08d
@ -1,3 +1,10 @@
|
||||
2003-03-03 Richard M. Stallman <rms@gnu.org>
|
||||
|
||||
* buffer.c (Fkill_buffer): Use Frun_hook_with_args_until_failure
|
||||
to run kill-buffer-query-functions.
|
||||
(Qkill_buffer_query_functions): New var.
|
||||
(syms_of_buffer): Init and staticpro it.
|
||||
|
||||
2003-03-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
|
||||
|
||||
* xterm.h (XSync): Define as gdk_window_process_all_updates for GTK.
|
||||
|
14
src/buffer.c
14
src/buffer.c
@ -150,6 +150,7 @@ Lisp_Object Vinhibit_read_only;
|
||||
/* List of functions to call that can query about killing a buffer.
|
||||
If any of these functions returns nil, we don't kill it. */
|
||||
Lisp_Object Vkill_buffer_query_functions;
|
||||
Lisp_Object Qkill_buffer_query_functions;
|
||||
|
||||
/* List of functions to call before changing an unmodified buffer. */
|
||||
Lisp_Object Vfirst_change_hook;
|
||||
@ -1304,18 +1305,16 @@ with SIGHUP. */)
|
||||
{
|
||||
int count = SPECPDL_INDEX ();
|
||||
Lisp_Object list;
|
||||
Lisp_Object arglist[1];
|
||||
|
||||
record_unwind_protect (save_excursion_restore, save_excursion_save ());
|
||||
set_buffer_internal (b);
|
||||
|
||||
/* First run the query functions; if any query is answered no,
|
||||
don't kill the buffer. */
|
||||
for (list = Vkill_buffer_query_functions; CONSP (list); list = XCDR (list))
|
||||
{
|
||||
tem = call0 (XCAR (list));
|
||||
if (NILP (tem))
|
||||
return unbind_to (count, Qnil);
|
||||
}
|
||||
arglist[0] = Qkill_buffer_query_functions;
|
||||
if (NILP (Frun_hook_with_args_until_failure (1, arglist)))
|
||||
return unbind_to (count, Qnil);
|
||||
|
||||
/* Then run the hooks. */
|
||||
Frun_hooks (1, &Qkill_buffer_hook);
|
||||
@ -5151,6 +5150,9 @@ syms_of_buffer ()
|
||||
staticpro (&Qafter_change_functions);
|
||||
staticpro (&Qucs_set_table_for_input);
|
||||
|
||||
Qkill_buffer_query_functions = intern ("kill-buffer-query-functions");
|
||||
staticpro (&Qkill_buffer_query_functions);
|
||||
|
||||
Fput (Qprotected_field, Qerror_conditions,
|
||||
Fcons (Qprotected_field, Fcons (Qerror, Qnil)));
|
||||
Fput (Qprotected_field, Qerror_message,
|
||||
|
Loading…
Reference in New Issue
Block a user