[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there an ELisp function for reading file contents in a string?
From: |
Juanma Barranquero |
Subject: |
Re: Is there an ELisp function for reading file contents in a string? |
Date: |
Wed, 6 Feb 2008 16:13:01 +0100 |
On Feb 6, 2008 2:11 PM, <stephan.zimmer@googlemail.com> wrote:
> The
> only, yet not very charming, possibility that I currently see is to
> use the "insert-file" function in combination with the "buffer-
> (sub)string" function and later erase the inserted file contents
> again.
Why "not charming"? You don't really need to erase the contents afterwards:
(defun file-as-string (file &optional beg end)
(with-temp-buffer
(insert-file-contents file nil beg end)
(buffer-string)))
What is the problem with that?
Juanma