help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File I/O


From: Robert Thorpe
Subject: Re: File I/O
Date: 2 Nov 2006 10:19:05 -0800
User-agent: G2/1.0

Tim Johnson wrote:
> On 2006-11-02, Robert Thorpe <rthorpe@realworldtech.com> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]