all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: stephan.zimmer@googlemail.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Is there an ELisp function for reading file contents in a string?
Date: Wed, 6 Feb 2008 16:13:01 +0100	[thread overview]
Message-ID: <f7ccd24b0802060713s347740e9pc0012a80de82cb3b@mail.gmail.com> (raw)
In-Reply-To: <2cc58ccd-001d-42bc-ad4f-0824204ffc5a@i12g2000prf.googlegroups.com>

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




  reply	other threads:[~2008-02-06 15:13 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 [this message]
     [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
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0802060713s347740e9pc0012a80de82cb3b@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=stephan.zimmer@googlemail.com \
    /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.