[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5273: 23.1; format-alist encode vs write-region-post-annotation-func
From: |
Stefan Monnier |
Subject: |
bug#5273: 23.1; format-alist encode vs write-region-post-annotation-function |
Date: |
Fri, 22 Jan 2010 10:29:35 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) |
>> the issue of temp buffers accumulating if to-fn errors out is indeed
>> a problem, but not a new one,
> I presume kill-on-write was an attempt to address that though.
No, not at all, the kill-on-write is done so that the buffer gets killed
after the calling's write-region terminates (the
post-annotation-function returns the buffer to write-region, so it
cannot kill it itself and is not involved any more after that so it has
no direct way to kill the buffer other than via this
write-region-post-annotation-function).
> As I say, I suspect the `format-count' passed from build_annotations()
> naming the buffer "Format Temp 0" etc the same on each call will keep a
> lid on how many leftovers.
> I suspect that also means it's not reentrant -- if the TO-FN writes from
> another buffer with a buffer-file-format then "Format Temp 0" will get
> re-used and clobbered too soon.
Could be.
>> with-temp-buffer is not an option, since the new "temp" buffer (usually)
>> needs to be returned as the new current-buffer at the end of
>> the function.
> There must be some far-enough outer scope of write-region or whatever
> where temporaries can be discarded ... but the amount of stuff done just
> to save some bytes is scary! :-)
Yes, but at that outside point, we don't know if such a temp buffer will
be needed, and worse, we don't know how many (there can be several
annotation functions that each take a buffer as input and produce the
result into a new output buffer).
Stefan