Subject: Re: bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook

From: martin rudalics <[email-masked]>
Date: Wed, 22 May 2019 10:32:39 +0200

>> I have not managed to understand the Vcode_conversion_workbuf_name
 >> vs Vcode_conversion_reused_workbuf rigmarole yet.
 >
 > The latter is a fixed buffer, created once and never killed.  So the
 > buffer hooks never run for it, and never affect Emacs.  By contrast,
 > the former is a buffer created when the reused buffer is busy and
 > cannot be reused.  We then kill Vcode_conversion_workbuf_name when we
 > no longer need it.  Thus, buffer hooks run for these work buffers all
 > the time, and for a code-conversion intensive code they could slow
 > down Emacs, specially if the list of buffer hooks is long.

Thanks, I hope I understand it now.  Could you pretty please add the
(instructive for me) "a buffer created when the reused buffer is busy
and cannot be reused" somewhere to the comments maybe together with a
reference to reused_workbuf_in_use.

Hopefully this also means that we can use _something like_
Fgenerate_new_buffer to replace both instances of Fget_buffer_create
in code_conversion_restore.

 > Since we currently keep this special treatment limited to a small
 > number of buffer names, I'm not sure there's a need to expose this
 > facility to Lisp.

I'm not sure either.

 >>> Buffer names starting with spaces are already special in some contexts,
 >>> so extending that idea for inhibiting buffer hooks doesn't sound too
 >>> bad,
 >>
 >> Eli thinks that "this is too drastic a measure".
 >
 > Yes.  No one said buffer hooks must _never_ run for temporary buffers.
 > There could be legitimate Lisp programs which want those hooks to run
 > in that case.

I have to agree.

martin