unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: dmoncayo@gmail.com, 18823@debbugs.gnu.org
Subject: bug#18823: Built-in support for visiting compressed files
Date: Wed, 14 Jul 2021 15:49:32 +0300	[thread overview]
Message-ID: <83bl7583hf.fsf@gnu.org> (raw)
In-Reply-To: <87h7gxoqcz.fsf_-_@gnus.org> (message from Lars Ingebrigtsen on Tue, 13 Jul 2021 23:28:44 +0200)

> 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?





  reply	other threads:[~2021-07-14 12:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-25  9:17 bug#18823: 24.4; Built-in support on MS-Windows for visiting compressed files Dani Moncayo
2014-10-25  9:27 ` Eli Zaretskii
2021-07-13 21:28   ` bug#18823: Built-in support " Lars Ingebrigtsen
2021-07-14 12:49     ` Eli Zaretskii [this message]
2021-07-14 13:05       ` Lars Ingebrigtsen
2021-07-14 13:16         ` Eli Zaretskii
2021-07-14 13:17           ` Lars Ingebrigtsen
2021-07-14 13:50           ` Lars Ingebrigtsen
2014-10-25  9:37 ` bug#18823: 24.4; " Dani Moncayo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83bl7583hf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=18823@debbugs.gnu.org \
    --cc=dmoncayo@gmail.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).