From: Ted Zlatanov <tzz@lifelogs.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Is there an ELisp function for reading file contents in a string?
Date: Wed, 06 Feb 2008 12:22:24 -0600 [thread overview]
Message-ID: <86zlue9c7z.fsf@lifelogs.com> (raw)
In-Reply-To: mailman.7038.1202310789.18990.help-gnu-emacs@gnu.org
On Wed, 6 Feb 2008 16:13:01 +0100 "Juanma Barranquero" <lekktu@gmail.com> wrote:
JB> 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.
JB> Why "not charming"? You don't really need to erase the contents afterwards:
JB> (defun file-as-string (file &optional beg end)
JB> (with-temp-buffer
JB> (insert-file-contents file nil beg end)
JB> (buffer-string)))
JB> What is the problem with that?
I would suggest to the OP that he may also want to look at the
coding-system-for-read variable, in case the default coding system is
not what he needs (I've run into problems there).
insert-file-contents-literally might also be a good choice if
appropriate.
Ted
next prev parent reply other threads:[~2008-02-06 18:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 13:11 Is there an ELisp function for reading file contents in a string? stephan.zimmer
2008-02-06 15:13 ` Juanma Barranquero
[not found] ` <mailman.7038.1202310789.18990.help-gnu-emacs@gnu.org>
2008-02-06 16:07 ` stephan.zimmer
2008-02-06 18:22 ` Ted Zlatanov [this message]
2008-02-06 22:52 ` Juanma Barranquero
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=86zlue9c7z.fsf@lifelogs.com \
--to=tzz@lifelogs.com \
--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.
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).