From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.help Subject: Re: Is there an ELisp function for reading file contents in a string? Date: Wed, 6 Feb 2008 16:13:01 +0100 Message-ID: References: <2cc58ccd-001d-42bc-ad4f-0824204ffc5a@i12g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1202310824 22048 80.91.229.12 (6 Feb 2008 15:13:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Feb 2008 15:13:44 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: stephan.zimmer@googlemail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 06 16:14:06 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JMlyN-0000Cz-4d for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Feb 2008 16:14:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JMlxv-000829-20 for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Feb 2008 10:13:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JMlxT-0007vt-TI for help-gnu-emacs@gnu.org; Wed, 06 Feb 2008 10:13:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JMlxR-0007uR-F9 for help-gnu-emacs@gnu.org; Wed, 06 Feb 2008 10:13:06 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JMlxR-0007uM-7e for help-gnu-emacs@gnu.org; Wed, 06 Feb 2008 10:13:05 -0500 Original-Received: from wa-out-1112.google.com ([209.85.146.177]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JMlxQ-000895-FS for help-gnu-emacs@gnu.org; Wed, 06 Feb 2008 10:13:04 -0500 Original-Received: by wa-out-1112.google.com with SMTP id k34so473942wah.10 for ; Wed, 06 Feb 2008 07:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=NhHdsroNgph4QMVIJModDPePbdSQnFQ+UvlxMUaER+g=; b=cTDlnhqBvjTFYknGAibj5SeYpXPaisD4IqNo2CW4dqLwoEcqvlLM3bqlt2wGpY2CW+dyJNKbz1DfleG8tQXKPJ8RP7/16Yo8TtxTfLfbVWf++zpFzmis/uXIHSJ83IQ3qYP82EYlsc6zEw96lkSdY1PfzOXTgemi9Vfqid+gf/k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pL+aGCpf/0i0M1Ccc+9Bv4x26eXrZs8L0uv+H7xGV5CA31/A07u0T6D2YS9Klf4c4L6kTFJWE8nulu14BU7opBxQ7YIXhVu9yVXz3EjJ3Ajyr3krMphH8VboQQR4jvdV72a7l8eT3pzaiIHBRPi9H5DR6wTpFfGBOuvzO1siWnE= Original-Received: by 10.114.80.4 with SMTP id d4mr3820946wab.44.1202310781683; Wed, 06 Feb 2008 07:13:01 -0800 (PST) Original-Received: by 10.114.170.5 with HTTP; Wed, 6 Feb 2008 07:13:01 -0800 (PST) In-Reply-To: <2cc58ccd-001d-42bc-ad4f-0824204ffc5a@i12g2000prf.googlegroups.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:51254 Archived-At: On Feb 6, 2008 2:11 PM, 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