From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to copy current buffer to a temporary buffer
Date: Fri, 16 May 2014 13:13:50 +0300 [thread overview]
Message-ID: <8338gaf2u9.fsf@gnu.org> (raw)
In-Reply-To: <87ha4qjci7.fsf@kuiper.lan.informatimago.com>
> From: "Pascal J. Bourguignon" <pjb@informatimago.com>
> Date: Fri, 16 May 2014 11:31:28 +0200
>
> Cecil Westerhof <Cecil@decebal.nl> writes:
>
> > I want to copy the current buffer to a temporary buffer, to do some
> > edits on it. (Converting a text file to a html file.)
>
>
> (let ((contents (buffer-substring (point-min) (point-max))))
> (with-temp-buffer
> (insert contents)
> (do-something)))
I think using the insert-buffer function will make this more efficient
(since no string needs to be consed, something that might not be
trivial with large buffers).
next prev parent reply other threads:[~2014-05-16 10:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 7:59 How to copy current buffer to a temporary buffer Cecil Westerhof
2014-05-16 9:31 ` Pascal J. Bourguignon
2014-05-16 10:13 ` Eli Zaretskii [this message]
[not found] ` <mailman.1456.1400235243.1147.help-gnu-emacs@gnu.org>
2014-05-16 11:49 ` Cecil Westerhof
2014-05-16 18:22 ` Pascal J. Bourguignon
2014-05-16 19:05 ` Thien-Thi Nguyen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8338gaf2u9.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.