[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to copy current buffer to a temporary buffer
From: |
Eli Zaretskii |
Subject: |
Re: How to copy current buffer to a temporary buffer |
Date: |
Fri, 16 May 2014 13:13:50 +0300 |
> 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).