diff options
| author | Richard M. Stallman | 2003-03-03 19:09:40 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-03-03 19:09:40 +0000 |
| commit | 5b20caf08da67b65f632e75113e1fbb91c4438e0 (patch) | |
| tree | 9a1c549f837c168662434206b54c0920be18a464 /src | |
| parent | 710ee5a968b14db059538f74d062302b18619f79 (diff) | |
| download | emacs-5b20caf08da67b65f632e75113e1fbb91c4438e0.tar.gz emacs-5b20caf08da67b65f632e75113e1fbb91c4438e0.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/buffer.c | 14 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ab250a2f10e..c5db3849fb8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2003-03-03 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * buffer.c (Fkill_buffer): Use Frun_hook_with_args_until_failure | ||
| 4 | to run kill-buffer-query-functions. | ||
| 5 | (Qkill_buffer_query_functions): New var. | ||
| 6 | (syms_of_buffer): Init and staticpro it. | ||
| 7 | |||
| 1 | 2003-03-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 8 | 2003-03-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 9 | ||
| 3 | * xterm.h (XSync): Define as gdk_window_process_all_updates for GTK. | 10 | * xterm.h (XSync): Define as gdk_window_process_all_updates for GTK. |
diff --git a/src/buffer.c b/src/buffer.c index bfb234773ea..5b57be7246a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -150,6 +150,7 @@ Lisp_Object Vinhibit_read_only; | |||
| 150 | /* List of functions to call that can query about killing a buffer. | 150 | /* 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. */ | 151 | If any of these functions returns nil, we don't kill it. */ |
| 152 | Lisp_Object Vkill_buffer_query_functions; | 152 | Lisp_Object Vkill_buffer_query_functions; |
| 153 | Lisp_Object Qkill_buffer_query_functions; | ||
| 153 | 154 | ||
| 154 | /* List of functions to call before changing an unmodified buffer. */ | 155 | /* List of functions to call before changing an unmodified buffer. */ |
| 155 | Lisp_Object Vfirst_change_hook; | 156 | Lisp_Object Vfirst_change_hook; |
| @@ -1304,18 +1305,16 @@ with SIGHUP. */) | |||
| 1304 | { | 1305 | { |
| 1305 | int count = SPECPDL_INDEX (); | 1306 | int count = SPECPDL_INDEX (); |
| 1306 | Lisp_Object list; | 1307 | Lisp_Object list; |
| 1308 | Lisp_Object arglist[1]; | ||
| 1307 | 1309 | ||
| 1308 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1310 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 1309 | set_buffer_internal (b); | 1311 | set_buffer_internal (b); |
| 1310 | 1312 | ||
| 1311 | /* First run the query functions; if any query is answered no, | 1313 | /* First run the query functions; if any query is answered no, |
| 1312 | don't kill the buffer. */ | 1314 | don't kill the buffer. */ |
| 1313 | for (list = Vkill_buffer_query_functions; CONSP (list); list = XCDR (list)) | 1315 | arglist[0] = Qkill_buffer_query_functions; |
| 1314 | { | 1316 | if (NILP (Frun_hook_with_args_until_failure (1, arglist))) |
| 1315 | tem = call0 (XCAR (list)); | 1317 | return unbind_to (count, Qnil); |
| 1316 | if (NILP (tem)) | ||
| 1317 | return unbind_to (count, Qnil); | ||
| 1318 | } | ||
| 1319 | 1318 | ||
| 1320 | /* Then run the hooks. */ | 1319 | /* Then run the hooks. */ |
| 1321 | Frun_hooks (1, &Qkill_buffer_hook); | 1320 | Frun_hooks (1, &Qkill_buffer_hook); |
| @@ -5151,6 +5150,9 @@ syms_of_buffer () | |||
| 5151 | staticpro (&Qafter_change_functions); | 5150 | staticpro (&Qafter_change_functions); |
| 5152 | staticpro (&Qucs_set_table_for_input); | 5151 | staticpro (&Qucs_set_table_for_input); |
| 5153 | 5152 | ||
| 5153 | Qkill_buffer_query_functions = intern ("kill-buffer-query-functions"); | ||
| 5154 | staticpro (&Qkill_buffer_query_functions); | ||
| 5155 | |||
| 5154 | Fput (Qprotected_field, Qerror_conditions, | 5156 | Fput (Qprotected_field, Qerror_conditions, |
| 5155 | Fcons (Qprotected_field, Fcons (Qerror, Qnil))); | 5157 | Fcons (Qprotected_field, Fcons (Qerror, Qnil))); |
| 5156 | Fput (Qprotected_field, Qerror_message, | 5158 | Fput (Qprotected_field, Qerror_message, |