diff options
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c index 5fabbc253c8..8bdc30300ba 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -37,6 +37,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "window.h" #include "commands.h" #include "character.h" +#include "coding.h" #include "buffer.h" #include "region-cache.h" #include "indent.h" @@ -583,6 +584,11 @@ even if it is dead. The return value is never nil. */) set_string_intervals (name, NULL); bset_name (b, name); + if (STRINGP (Vcode_conversion_workbuf_name) + && strncmp (SSDATA (name), SSDATA (Vcode_conversion_workbuf_name), + SBYTES (Vcode_conversion_workbuf_name)) == 0) + b->inhibit_buffer_hooks = true; + bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt); reset_buffer (b); @@ -595,7 +601,7 @@ even if it is dead. The return value is never nil. */) XSETBUFFER (buffer, b); Vbuffer_alist = nconc2 (Vbuffer_alist, list1 (Fcons (name, buffer))); /* And run buffer-list-update-hook. */ - if (!NILP (Vrun_hooks)) + if (!NILP (Vrun_hooks) && !b->inhibit_buffer_hooks) call1 (Vrun_hooks, Qbuffer_list_update_hook); return buffer; @@ -1493,7 +1499,7 @@ This does not change the name of the visited file (if any). */) call0 (intern ("rename-auto-save-file")); /* Run buffer-list-update-hook. */ - if (!NILP (Vrun_hooks)) + if (!NILP (Vrun_hooks) && !current_buffer->inhibit_buffer_hooks) call1 (Vrun_hooks, Qbuffer_list_update_hook); /* Refetch since that last call may have done GC. */ @@ -1706,8 +1712,9 @@ cleaning up all windows currently displaying the buffer to be killed. */) /* First run the query functions; if any query is answered no, don't kill the buffer. */ - tem = CALLN (Frun_hook_with_args_until_failure, - Qkill_buffer_query_functions); + if (!b->inhibit_buffer_hooks) + tem = CALLN (Frun_hook_with_args_until_failure, + Qkill_buffer_query_functions); if (NILP (tem)) return unbind_to (count, Qnil); @@ -1726,7 +1733,8 @@ cleaning up all windows currently displaying the buffer to be killed. */) return unbind_to (count, Qt); /* Then run the hooks. */ - run_hook (Qkill_buffer_hook); + if (!b->inhibit_buffer_hooks) + run_hook (Qkill_buffer_hook); unbind_to (count, Qnil); } @@ -1928,7 +1936,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) bset_undo_list (b, Qnil); /* Run buffer-list-update-hook. */ - if (!NILP (Vrun_hooks)) + if (!NILP (Vrun_hooks) && !b->inhibit_buffer_hooks) call1 (Vrun_hooks, Qbuffer_list_update_hook); return Qt; @@ -1970,7 +1978,7 @@ record_buffer (Lisp_Object buffer) fset_buried_buffer_list (f, Fdelq (buffer, f->buried_buffer_list)); /* Run buffer-list-update-hook. */ - if (!NILP (Vrun_hooks)) + if (!NILP (Vrun_hooks) && !XBUFFER (buffer)->inhibit_buffer_hooks) call1 (Vrun_hooks, Qbuffer_list_update_hook); } @@ -2009,7 +2017,7 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal, (f, Fcons (buffer, Fdelq (buffer, f->buried_buffer_list))); /* Run buffer-list-update-hook. */ - if (!NILP (Vrun_hooks)) + if (!NILP (Vrun_hooks) && !XBUFFER (buffer)->inhibit_buffer_hooks) call1 (Vrun_hooks, Qbuffer_list_update_hook); return Qnil; |