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 16:16:24 +0300	[thread overview]
Message-ID: <834kcx828n.fsf@gnu.org> (raw)
In-Reply-To: <87o8b5jbau.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed,  14 Jul 2021 15:05:13 +0200)

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dmoncayo@gmail.com,  18823@debbugs.gnu.org
> Date: Wed, 14 Jul 2021 15:05:13 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > 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?
> 
> It just does the contortion for you.

So you want a function that does

  (let ((source-buf (current-buffer)))
    (with-current-buffer target-buf
      (insert-buffer-substring source-buf ...)))

is that it?

> This sort of thing comes up mostly when doing stuff with temporary
> buffers, so I wonder whether we should consider adding a special form
> for it.  That is, something like `with-temp-buffer-and-insert' that
> would work identically as `with-temp-buffer', but insert the contents of
> the buffer into the current buffer before killing the temporary
> buffer...

If it's something one must do a lot, maybe...





  reply	other threads:[~2021-07-14 13:16 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
2021-07-14 13:05       ` Lars Ingebrigtsen
2021-07-14 13:16         ` Eli Zaretskii [this message]
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=834kcx828n.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).