[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18823: Built-in support for visiting compressed files
From: |
Eli Zaretskii |
Subject: |
bug#18823: Built-in support for visiting compressed files |
Date: |
Wed, 14 Jul 2021 15:49:32 +0300 |
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Dani Moncayo <dmoncayo@gmail.com>, 18823@debbugs.gnu.org
> Date: Tue, 13 Jul 2021 23:28:44 +0200
>
> 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.
To insert text, you must make the buffer into which you insert be the
current buffer. That's how the low-level insertion primitives work.
So what will insert-into-buffer do that is different (and more
efficient) than the contortion you need to do now, which involves
temporary switch to the target buffer?
Or what am I missing?