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

From: "Basil L. Contovounesios" <[email-masked]>
Date: Sat, 19 Dec 2020 14:15:30 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: "Basil L. Contovounesios" <[email-masked]>
>> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked],
>>   [email-masked],  [email-masked]
>> Date: Fri, 18 Dec 2020 18:49:52 +0000
>> 
>> * .dir-locals.el (c-mode): Enforce existing indent-tabs-mode policy.
>
> This should be in a separate commit, IMO.

Okay, I pushed it separately.

>> +By default, undo information (@pxref{Undo}) is not recorded in the
>> +buffer created by this macro (but @var{body} can enable that, if
>> +needed).  The temporary buffer also does not run the hooks
>> +@code{kill-buffer-hook}, @code{kill-buffer-query-functions}
>> +(@pxref{Killing Buffers}), and @code{buffer-list-update-hook}
>> +(@pxref{Buffer List}).
>
> It would be good to have here index entries about undo and those hooks
> not being used by default in temporary buffers.

Something like this?

  @cindex undo in temporary buffers
  @cindex @code{kill-buffer-hook} in temporary buffers
  @cindex @code{kill-buffer-query-functions} in temporary buffers
  @cindex @code{buffer-list-update-hook} in temporary buffers

>> +Like @code{with-temp-buffer} (@pxref{Definition of with-temp-buffer,,
>                                         ^^^^^^^^^^
> I think this word will look better if not capitalized.

The printed label "see Current Buffer" should be displayed instead of
this word, which is part of the anchor.  Is that okay?

>> +static void
>> +run_buffer_list_update_hook (struct buffer *buf)
>> +{
>> +  if (! (NILP (Vrun_hooks) || (buf && buf->inhibit_buffer_hooks)))
>                                   ^^^
> Why this test? is it possible for this function to be called with buf
> a NULL pointer?

Yes, in Fmake_indirect_buffer, which doesn't check inhibit_buffer_hooks.

The alternatives would be for Fmake_indirect_buffer to not call
run_buffer_list_update_hook, or to not bother adding
run_buffer_list_update_hook at all.  Do you have a preference?

Thanks,

-- 
Basil