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

From: martin rudalics <[email-masked]>
Date: Wed, 06 Mar 2019 18:57:07 +0100

>> Maybe we should indeed rebind 'buffer-list-update-hook' around the
 >> 'generate-new-buffer' and 'kill-buffer' calls of 'with-temp-buffer'.
 >
 > Wouldn't that be a backward-incompatible change?

It would be a backward-incompatible change.

 > How long did we call
 > that hook for temporary buffers?

Ever since that hook existed.

 > Also, can generate-new-buffer and/or
 > kill-buffer run some hooks which might modify other, non-temporary
 > buffers?

'generate-new-buffer' calls 'get-buffer-create' and that one runs only
'buffer-list-update-hook'.  'kill-buffer' runs its usual hooks and if
one of them runs 'kill-buffer' for another buffer we'd have a problem.

An even more radical solution would be to never run
'buffer-list-update-hook' for buffers whose name starts with a space.
Backward-incompatible as well but cleaner from a designer's POV.

In either case it wouldn't help the OP since he probably (hopefully)
won't need a solution for Emacs 27 (where he should be able to use
'window-selection-change-functions' instead) and we are certainly not
going to change this for Emacs 26.

martin