From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: John Sullivan Newsgroups: gmane.emacs.help Subject: Re: how to read file's content using elisp? Date: Wed, 15 Sep 2004 14:10:34 -0400 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87656fbdyd.fsf@johnsu01.isa-geek.net> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0067350426==" X-Trace: sea.gmane.org 1095288677 25258 80.91.229.6 (15 Sep 2004 22:51:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Sep 2004 22:51:17 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 16 00:51:09 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C7icG-0004YV-00 for ; Thu, 16 Sep 2004 00:51:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C7ihu-0004yp-Ng for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Sep 2004 18:56:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C7ihl-0004yU-8j for help-gnu-emacs@gnu.org; Wed, 15 Sep 2004 18:56:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C7ihj-0004yI-Kg for help-gnu-emacs@gnu.org; Wed, 15 Sep 2004 18:56:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C7ihj-0004yF-IY for help-gnu-emacs@gnu.org; Wed, 15 Sep 2004 18:56:47 -0400 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C7ibx-00073M-Sr for help-gnu-emacs@gnu.org; Wed, 15 Sep 2004 18:50:50 -0400 Original-Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1C7ibw-0005LG-00 for ; Thu, 16 Sep 2004 00:50:48 +0200 Original-Received: from pool-151-203-108-233.bos.east.verizon.net ([151.203.108.233]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Sep 2004 00:50:48 +0200 Original-Received: from john by pool-151-203-108-233.bos.east.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Sep 2004 00:50:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 37 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: pool-151-203-108-233.bos.east.verizon.net User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:E99rDlEJa/k58wlZC9fyD+rhKDA= 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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:20693 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:20693 --===============0067350426== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Rokia writes: > what I want to do is reading a file's content into a string > variable. like this. > > (setq dddstring (foo-read-file "dd.txt")) > (prin1 dddstring) I'm not trustworthy on these matters, but here's a once-tested quickie: (defun foo-read-file (full-filename) "Read a file and return foo-file as a string." (with-temp-buffer (insert-file-contents full-filename) (buffer-string))) This should work with the syntax you used. -John --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBSIWhCRwR0q6GALYRAr9MAKCRqozFTxnAfAEnM5lsHYvFq6NfCQCeOY5s 00MbMJzWR60VK+lhiz/dSh0= =PJUB -----END PGP SIGNATURE----- --=-=-=-- --===============0067350426== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --===============0067350426==--