GNU bug report logs -
#34765
26.1; with-temp-buffer should not run buffer-list-update-hook
Previous Next
Reported by: Alexander Miller <alexanderm <at> web.de>
Date: Tue, 5 Mar 2019 22:58:02 UTC
Severity: normal
Tags: fixed
Found in version 26.1
Fixed in version 28.1
Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Bug is archived. No further changes may be made.
Full log
Message #56 received at 34765 <at> debbugs.gnu.org (full text, mbox):
>> > I meant to suggest that get-buffer-create sets this flag when the name
>> > of the buffer fits the template of temporary buffers. Exactly like it
>> > does for code-conversion buffers now.
>>
>> We don't have a "template of temporary buffers".
>
> Of course we do: with-temp-buffer produces buffer names that follow
> such a template.
IIUC we'd need an expression similar to Vcode_conversion_workbuf_name
to use in 'get-buffer-create'
b->inhibit_buffer_hooks
= (STRINGP (Vcode_conversion_workbuf_name)
&& strncmp (SSDATA (name), SSDATA (Vcode_conversion_workbuf_name),
SBYTES (Vcode_conversion_workbuf_name)) == 0);
So we could specify, for example,
staticpro (&Vtemp_buffer_name);
Vtemp_buffer_name = build_pure_c_string (" *temp*");
and rewrite the above assignment as
b->inhibit_buffer_hooks
= ((STRINGP (Vcode_conversion_workbuf_name)
&& strncmp (SSDATA (name), SSDATA (Vcode_conversion_workbuf_name),
SBYTES (Vcode_conversion_workbuf_name)) == 0)
|| (STRINGP (Vtemp_buffer_name)
&& strncmp (SSDATA (name), SSDATA (Vtemp_buffer_name),
SBYTES (Vtemp_buffer_name)) == 0));
>> For example, a buffer specified by the BUFNAME arg of
>> 'with-output-to-temp-buffer' should not match such a template.
>
> Such buffers should not necessarily be exempt from running the hooks,
> AFAIU. In any case, one can always bind the hook locally to nil in
> the body of the macro, right?
Unless the body changes the buffer list in some signifcant way, for
example, by creating or deleting another buffer.
>> But I'd favor a solution that skips all buffers whose name starts
>> with a space as we do for 'other-buffer' or 'unbury-buffer'.
>
> I think this is too drastic a measure. We should only disable the
> hooks in buffers where no one in their right minds will ever want to
> run them.
Then what about the buffers created by 'with-temp-file' or
'with-output-to-string'?
martin
This bug report was last modified 4 years and 152 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.