Subject: Re: bug#57129: 29.0.50; Improve behavior of conditionals in Eshell

From: Jim Porter <[email-masked]>
Date: Sat, 20 Aug 2022 11:49:34 -0700

On 8/20/2022 11:14 AM, Eli Zaretskii wrote:
>> Cc: [email-masked], [email-masked]
>> From: Jim Porter <[email-masked]>
>> Date: Sat, 20 Aug 2022 11:03:27 -0700
>>
>> In addition to the changes to temporary file name generation, I think it
>> would be useful for Eshell to kill the temporary buffer too. If you use
>> this feature in Eshell a lot, the temporary buffers could pile up,
>> consuming memory for no real benefit. (A user who wanted the buffer to
>> stick around would probably redirect to a non-temporary file, or even
>> just to a buffer.) Attached is a patch to do this.
> 
> That makes sense, of course, but why not use with-temp-buffer in the
> first place?

I'm not sure that would work in this case. 'with-temp-buffer' (or 
probably 'with-temp-file', since we want a real file) would clean 
everything up once BODY has executed, but we want to perform cleanup in 
a hook, which might execute quite a while later (e.g. if passing this 
temp file to an external process).

If there's a way to use that though, I'm all for it.