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

From: Stefan Monnier <[email-masked]>
Date: Thu, 25 Apr 2019 09:01:01 -0400

> -    `(let ((,temp-buffer (generate-new-buffer " *temp*")))
> +    `(let ((,temp-buffer
> +	    (let ((inhibit-buffer-list-update-hook t))
> +              (generate-new-buffer " *temp*"))))
>         ;; FIXME: kill-buffer can change current-buffer in some odd cases.
>         (with-current-buffer ,temp-buffer
>           (unwind-protect
>  	     (progn ,@body)
>             (and (buffer-name ,temp-buffer)
> -                (kill-buffer ,temp-buffer)))))))
> +	        (let ((inhibit-buffer-list-update-hook t))
> +                  (kill-buffer ,temp-buffer))))))))

Hmm... I was thinking we could expose `inhibit_buffer_hooks` as a Lisp
variable (so we can set it without having to match names, which I find
ugly and brittle), but we'd want to `setq` it rather than let-bind it.
But while it's easy to set it before running kill-buffer, we can't set
it before calling generate-new-buffer :-(

How 'bout adding an optional argument to `generate-new-buffer` to set
`inhibit_buffer_hooks`?

        Stefan