bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: martin rudalics
Subject: bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook
Date: Thu, 23 May 2019 10:38:38 +0200

>> 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.
>
> Not sure where you want to add this.  coding.c already says:

That's what I've read and did not understand.  It's a bit too concise.

>    /* Name (or base name) of work buffer for code conversion.  */
>    Lisp_Object Vcode_conversion_workbuf_name;

This comment insinuates that there is only one such buffer.

>    /* A working buffer used by the top level conversion.

What is the "top level conversion"?

>       Once it is
>       created, it is never destroyed.  It has the name
>       Vcode_conversion_workbuf_name.  The other working buffers are
>       destroyed after the use is finished, and their names are modified
>       versions of Vcode_conversion_workbuf_name.  */
>    static Lisp_Object Vcode_conversion_reused_workbuf;
>
>    /* True iff Vcode_conversion_reused_workbuf is already in use.  */
>    static bool reused_workbuf_in_use;
>
> is that what you wanted to see?

I'd prefer something like a common comment for all these variables
going as

/* The internal work buffers for code conversion are created lazily on
   demand.  The name of the first buffer created that way is specified
   by Vcode_conversion_workbuf_name.  Once created, this buffer is no
   more deleted in the current Emacs session.  While this buffer is in
   use, the boolean variable reused_workbuf_in_use is true.  This
   buffer is reused for new conversions whenever reused_workbuf_in_use
   is false.

   When reused_workbuf_in_use is true and more code conversion work
   has to be done, a new buffer is created.  The name of that new
   buffer is generated by Fgenerate_new_buffer_name, using
   Vcode_conversion_workbuf_name as base name.  Any such buffer is
   destroyed immediately as soon as it is no more used.  */

>> 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.
>
> You mean code_conversion_save, I presume.

You presume correctly.

> One of those calls to Fget_buffer_create shouldn't generate a new
> name, though.  It should always use a fixed name.

Fgenerate_new_buffer_name should do that: "If there is no live buffer
named NAME, then return NAME.".

Concludingly, what we need in the present context is a function

- to create a buffer whose name is generated from a base name
  argument,

- to set the new buffer's inhibit_buffer_hooks flag according to a
  corresponding argument and to not run any hooks when that flag
  should be set and the buffer is created,

- that is as internal as possible to avoid that applications misuse it
  (it can't be entirely internal since macros like 'with-temp-buffer'
  will need it).

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]