Mercurial > emacs
comparison src/buffer.c @ 6051:0b144d967f30
(Fkill_buffer): Call the Vkill_buffer_query_functions.
(syms_of_buffer): Make Lisp var for kill-buffer-query-functions.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Thu, 24 Feb 1994 05:34:16 +0000 |
| parents | 7f95b8e1ec44 |
| children | e40292d5c167 |
comparison
equal
deleted
inserted
replaced
| 6050:afc731c614d3 | 6051:0b144d967f30 |
|---|---|
| 114 | 114 |
| 115 /* t means ignore all read-only text properties. | 115 /* t means ignore all read-only text properties. |
| 116 A list means ignore such a property if its value is a member of the list. | 116 A list means ignore such a property if its value is a member of the list. |
| 117 Any non-nil value means ignore buffer-read-only. */ | 117 Any non-nil value means ignore buffer-read-only. */ |
| 118 Lisp_Object Vinhibit_read_only; | 118 Lisp_Object Vinhibit_read_only; |
| 119 | |
| 120 /* List of functions to call that can query about killing a buffer. | |
| 121 If any of these functions returns nil, we don't kill it. */ | |
| 122 Lisp_Object Vkill_buffer_query_functions; | |
| 119 | 123 |
| 120 /* List of functions to call before changing an unmodified buffer. */ | 124 /* List of functions to call before changing an unmodified buffer. */ |
| 121 Lisp_Object Vfirst_change_hook; | 125 Lisp_Object Vfirst_change_hook; |
| 122 Lisp_Object Qfirst_change_hook; | 126 Lisp_Object Qfirst_change_hook; |
| 123 | 127 |
| 727 UNGCPRO; | 731 UNGCPRO; |
| 728 if (NILP (tem)) | 732 if (NILP (tem)) |
| 729 return Qnil; | 733 return Qnil; |
| 730 } | 734 } |
| 731 | 735 |
| 732 /* Run kill-buffer hook with the buffer to be killed the current buffer. */ | 736 /* Run hooks with the buffer to be killed the current buffer. */ |
| 733 { | 737 { |
| 734 register Lisp_Object val; | 738 register Lisp_Object val; |
| 735 int count = specpdl_ptr - specpdl; | 739 int count = specpdl_ptr - specpdl; |
| 740 Lisp_Object list; | |
| 736 | 741 |
| 737 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 742 record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 738 set_buffer_internal (b); | 743 set_buffer_internal (b); |
| 744 | |
| 745 /* First run the query functions; if any query is answered no, | |
| 746 don't kill the buffer. */ | |
| 747 for (list = Vkill_buffer_query_functions; !NILP (list); list = Fcdr (list)) | |
| 748 { | |
| 749 tem = call0 (Fcar (list)); | |
| 750 if (NILP (tem)) | |
| 751 return unbind_to (count, Qnil); | |
| 752 } | |
| 753 | |
| 754 /* Then run the hooks. */ | |
| 739 call1 (Vrun_hooks, Qkill_buffer_hook); | 755 call1 (Vrun_hooks, Qkill_buffer_hook); |
| 740 unbind_to (count, Qnil); | 756 unbind_to (count, Qnil); |
| 741 } | 757 } |
| 742 | 758 |
| 743 /* We have no more questions to ask. Verify that it is valid | 759 /* We have no more questions to ask. Verify that it is valid |
| 2613 text properties. If the value is a list, disregard `buffer-read-only'\n\ | 2629 text properties. If the value is a list, disregard `buffer-read-only'\n\ |
| 2614 and disregard a `read-only' text property if the property value\n\ | 2630 and disregard a `read-only' text property if the property value\n\ |
| 2615 is a member of the list."); | 2631 is a member of the list."); |
| 2616 Vinhibit_read_only = Qnil; | 2632 Vinhibit_read_only = Qnil; |
| 2617 | 2633 |
| 2634 DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, | |
| 2635 "List of functions called with no args to query before killing a buffer."); | |
| 2636 Vkill_buffer_query_functions = Qnil; | |
| 2637 | |
| 2618 defsubr (&Sbuffer_list); | 2638 defsubr (&Sbuffer_list); |
| 2619 defsubr (&Sget_buffer); | 2639 defsubr (&Sget_buffer); |
| 2620 defsubr (&Sget_file_buffer); | 2640 defsubr (&Sget_file_buffer); |
| 2621 defsubr (&Sget_buffer_create); | 2641 defsubr (&Sget_buffer_create); |
| 2622 defsubr (&Sgenerate_new_buffer_name); | 2642 defsubr (&Sgenerate_new_buffer_name); |
