From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Robert Thorpe" Newsgroups: gmane.emacs.help Subject: Re: File I/O Date: 2 Nov 2006 10:19:05 -0800 Organization: http://groups.google.com Message-ID: <1162491544.994880.84590@e3g2000cwe.googlegroups.com> References: <1162472024.435499.77510@e3g2000cwe.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1162492967 29882 80.91.229.2 (2 Nov 2006 18:42:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 2 Nov 2006 18:42:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 02 19:42:44 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GfhVH-00036d-61 for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Nov 2006 19:41:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfhVG-0003JL-LX for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Nov 2006 13:41:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!e3g2000cwe.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: 163.244.62.65 Original-X-Trace: posting.google.com 1162491549 15959 127.0.0.1 (2 Nov 2006 18:19:09 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 2 Nov 2006 18:19:09 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 EMF1ASPROXY03 Complaints-To: groups-abuse@google.com Injection-Info: e3g2000cwe.googlegroups.com; posting-host=163.244.62.65; posting-account=hWoAPxMAAAAnBKSBz1ZivwUPPjEuve7bvVCHZQ8rhrluPfwcBJd92w Original-Xref: shelby.stanford.edu gnu.emacs.help:142894 Original-To: help-gnu-emacs@gnu.org 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:38513 Archived-At: Tim Johnson wrote: > On 2006-11-02, Robert Thorpe wrote: > >> IOWS: read a file > >> process stream a line at a time > >> process programmatically > > > > Not really. The normal way of doing the above is to create a buffer > > for the file first. > > > > It might be better if you tell us what you're trying to do, that makes > > it easier to suggest something. > > My hope was to read a file into an emacs data structure. > text delimited by an arbitrary line ( blank or all hyphens as an > example) > > the data structure would be a list of lists. > > each internal list would have 3 elements. > > the first two would be strings, the last a list of strings. > and the structure would be accessed via 'assoc. > > ( ;; begin parent structure > ( ;; begin element > "chop" ;; key > "Remove last member" ;; terse description > ("Line one" "Line two" "Line three") ;; verbose description > ) > ) > You could use the command David mentions below for this. If you are defining the data file yourself there is no reason not to use elisp read and print. In elisp a set of lists can be printed by "print" and reconstructed by reading with "read". > I've created such a structure using a General Purpose Programming > Language, but had headaches with escaping. Thought using emacs > might bypass that problem. Escaping problems tend to be, erm, hard to escape. Using elisp may not help here.