aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorBasil L. Contovounesios2020-12-19 12:39:45 +0000
committerBasil L. Contovounesios2020-12-20 17:32:24 +0000
commit1a0a11f7d2d1dbecb9f754b1e129d50e489058e6 (patch)
treeca78c82ccc83b90ae3e382097fdffc928097f881 /src/process.c
parent409a9dbe9da64b4d75fec1f511e168c94e60e35b (diff)
downloademacs-1a0a11f7d2d1dbecb9f754b1e129d50e489058e6.tar.gz
emacs-1a0a11f7d2d1dbecb9f754b1e129d50e489058e6.zip
Inhibit buffer hooks in temporary buffers
Give get-buffer-create an optional argument to inhibit buffer hooks in internal or temporary buffers for efficiency (bug#34765). * etc/NEWS: Announce new parameter of get-buffer-create and generate-new-buffer, and that with-temp-buffer and with-temp-file now inhibit buffer hooks. * doc/lispref/buffers.texi (Buffer Names): Fix typo. (Creating Buffers): Document new parameter of get-buffer-create and generate-new-buffer. (Buffer List, Killing Buffers): Document when buffer hooks are inhibited. (Current Buffer): * doc/lispref/files.texi (Writing to Files): Document that with-temp-buffer and with-temp-file inhibit buffer hooks. * doc/lispref/internals.texi (Buffer Internals): Document inhibit_buffer_hooks flag. Remove stale comment. * doc/misc/gnus-faq.texi (FAQ 5-8): * lisp/simple.el (shell-command-on-region): Fix indentation. * lisp/files.el (kill-buffer-hook): Document when hook is inhibited. (create-file-buffer): * lisp/gnus/gnus-uu.el (gnus-uu-unshar-article): * lisp/international/mule.el (load-with-code-conversion): * lisp/mh-e/mh-xface.el (mh-x-image-url-fetch-image): * lisp/net/imap.el (imap-open): * lisp/net/mailcap.el (mailcap-maybe-eval): * lisp/progmodes/flymake-proc.el (flymake-proc--read-file-to-temp-buffer) (flymake-proc--copy-buffer-to-temp-buffer): Simplify. * lisp/subr.el (generate-new-buffer): Forward new optional argument to inhibit buffer hooks to get-buffer-create. (with-temp-file, with-temp-buffer, with-output-to-string): * lisp/json.el (json-encode-string): Inhibit buffer hooks in buffer used. * src/buffer.c (run_buffer_list_update_hook): New helper function. (Fget_buffer_create): Use it. Add optional argument to set inhibit_buffer_hooks flag instead of comparing the buffer name to Vcode_conversion_workbuf_name. All callers changed. (Fmake_indirect_buffer, Frename_buffer, Fbury_buffer_internal) (record_buffer): Use run_buffer_list_update_hook. (Fkill_buffer): Document when buffer hooks are inhibited. Use run_buffer_list_update_hook. (init_buffer_once): Inhibit buffer hooks in Vprin1_to_string_buffer. (Vkill_buffer_query_functions, Vbuffer_list_update_hook): Document when hooks are inhibited. * src/buffer.h (struct buffer): Update inhibit_buffer_hooks commentary. * src/coding.h (Vcode_conversion_workbuf_name): * src/coding.c (Vcode_conversion_workbuf_name): Make static again since it is no longer needed in src/buffer.c. (code_conversion_restore, code_conversion_save, syms_of_coding): Prefer boolean over integer constants. * src/fileio.c (Finsert_file_contents): Inhibit buffer hooks in " *code-converting-work*" buffer. * src/window.c (Fselect_window): Fix grammar. Mention window-selection-change-functions alongside buffer-list-update-hook. * test/src/buffer-tests.el: Fix requires. (buffer-tests-inhibit-buffer-hooks): New test.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c
index 4fe8ac7fc0c..9efefb1de73 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1731,7 +1731,7 @@ usage: (make-process &rest ARGS) */)
1731 1731
1732 buffer = Fplist_get (contact, QCbuffer); 1732 buffer = Fplist_get (contact, QCbuffer);
1733 if (!NILP (buffer)) 1733 if (!NILP (buffer))
1734 buffer = Fget_buffer_create (buffer); 1734 buffer = Fget_buffer_create (buffer, Qnil);
1735 1735
1736 /* Make sure that the child will be able to chdir to the current 1736 /* Make sure that the child will be able to chdir to the current
1737 buffer's current directory, or its unhandled equivalent. We 1737 buffer's current directory, or its unhandled equivalent. We
@@ -1768,7 +1768,7 @@ usage: (make-process &rest ARGS) */)
1768 QCname, 1768 QCname,
1769 concat2 (name, build_string (" stderr")), 1769 concat2 (name, build_string (" stderr")),
1770 QCbuffer, 1770 QCbuffer,
1771 Fget_buffer_create (xstderr), 1771 Fget_buffer_create (xstderr, Qnil),
1772 QCnoquery, 1772 QCnoquery,
1773 query_on_exit ? Qnil : Qt); 1773 query_on_exit ? Qnil : Qt);
1774 } 1774 }
@@ -2443,7 +2443,7 @@ usage: (make-pipe-process &rest ARGS) */)
2443 buffer = Fplist_get (contact, QCbuffer); 2443 buffer = Fplist_get (contact, QCbuffer);
2444 if (NILP (buffer)) 2444 if (NILP (buffer))
2445 buffer = name; 2445 buffer = name;
2446 buffer = Fget_buffer_create (buffer); 2446 buffer = Fget_buffer_create (buffer, Qnil);
2447 pset_buffer (p, buffer); 2447 pset_buffer (p, buffer);
2448 2448
2449 pset_childp (p, contact); 2449 pset_childp (p, contact);
@@ -3173,7 +3173,7 @@ usage: (make-serial-process &rest ARGS) */)
3173 buffer = Fplist_get (contact, QCbuffer); 3173 buffer = Fplist_get (contact, QCbuffer);
3174 if (NILP (buffer)) 3174 if (NILP (buffer))
3175 buffer = name; 3175 buffer = name;
3176 buffer = Fget_buffer_create (buffer); 3176 buffer = Fget_buffer_create (buffer, Qnil);
3177 pset_buffer (p, buffer); 3177 pset_buffer (p, buffer);
3178 3178
3179 pset_childp (p, contact); 3179 pset_childp (p, contact);
@@ -4188,7 +4188,7 @@ usage: (make-network-process &rest ARGS) */)
4188 open_socket: 4188 open_socket:
4189 4189
4190 if (!NILP (buffer)) 4190 if (!NILP (buffer))
4191 buffer = Fget_buffer_create (buffer); 4191 buffer = Fget_buffer_create (buffer, Qnil);
4192 4192
4193 /* Unwind bind_polling_period. */ 4193 /* Unwind bind_polling_period. */
4194 unbind_to (count, Qnil); 4194 unbind_to (count, Qnil);
@@ -4961,7 +4961,7 @@ server_accept_connection (Lisp_Object server, int channel)
4961 if (!NILP (buffer)) 4961 if (!NILP (buffer))
4962 { 4962 {
4963 args[1] = buffer; 4963 args[1] = buffer;
4964 buffer = Fget_buffer_create (Fformat (nargs, args)); 4964 buffer = Fget_buffer_create (Fformat (nargs, args), Qnil);
4965 } 4965 }
4966 } 4966 }
4967 4967