Subject: bug#18823: Built-in support for visiting compressed files

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 13 Jul 2021 23:28:44 +0200

Eli Zaretskii <[email-masked]> writes:

> So I think the requested feature could be reworded as follows: enhance
> jka-compr to support internal decompression methods such as
> zlib-decompress-region.

I've now added this to Emacs 28.  I added it as a fallback (when the
external programme doesn't exist), because that seemed least likely to
break something, but we could consider reversing the code (since it's
likely to be faster to use the internal function).

This also reminded me that I wanted to add a function that does the
"reverse" of `insert-buffer-substring', which I don't think we have.  That
is, to allow saying

(let ((buf (current-buffer)))
  (with-temp-buffer
    (create-lots-of-data)
    (insert-into-buffer buf (point-min) (point-max))))

in an efficient way.  When dealing with temporary buffers, you have to
contort yourself to use `insert-buffer-substring' in the other
direction, and

(insert
  (with-temp-buffer
    ...
    (buffer-string)))

is pretty inefficient.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no