all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* File I/O
@ 2006-11-02  2:54 Tim Johnson
  2006-11-02 12:53 ` Robert Thorpe
  2006-11-02 13:00 ` David Kastrup
  0 siblings, 2 replies; 5+ messages in thread
From: Tim Johnson @ 2006-11-02  2:54 UTC (permalink / raw)


Hi:

Is it possible to do File I/O with elisp.
  (as opposed to reading it into a buffer)

IOWS: read a file
      process stream a line at a time
	  process programmatically

thanks
tim

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File I/O
  2006-11-02  2:54 File I/O Tim Johnson
@ 2006-11-02 12:53 ` Robert Thorpe
  2006-11-02 16:54   ` Tim Johnson
  2006-11-02 13:00 ` David Kastrup
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Thorpe @ 2006-11-02 12:53 UTC (permalink / raw)


Tim Johnson wrote:
> Hi:
>
> Is it possible to do File I/O with elisp.
>   (as opposed to reading it into a buffer)
>
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File I/O
  2006-11-02  2:54 File I/O Tim Johnson
  2006-11-02 12:53 ` Robert Thorpe
@ 2006-11-02 13:00 ` David Kastrup
  1 sibling, 0 replies; 5+ messages in thread
From: David Kastrup @ 2006-11-02 13:00 UTC (permalink / raw)


Tim Johnson <tim@johnsons-web.com> writes:

> Is it possible to do File I/O with elisp.
>   (as opposed to reading it into a buffer)
>
> IOWS: read a file
>       process stream a line at a time
> 	  process programmatically

See `insert-file-contents' which can extract just parts from a file
into a buffer.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File I/O
  2006-11-02 12:53 ` Robert Thorpe
@ 2006-11-02 16:54   ` Tim Johnson
  2006-11-02 18:19     ` Robert Thorpe
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Johnson @ 2006-11-02 16:54 UTC (permalink / raw)


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
   ) 
 )

 I've created such a structure using a General Purpose Programming
 Language, but had headaches with escaping. Thought using emacs
 might bypass that problem.

 thanks
 tim

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File I/O
  2006-11-02 16:54   ` Tim Johnson
@ 2006-11-02 18:19     ` Robert Thorpe
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Thorpe @ 2006-11-02 18:19 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-11-02 18:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-02  2:54 File I/O Tim Johnson
2006-11-02 12:53 ` Robert Thorpe
2006-11-02 16:54   ` Tim Johnson
2006-11-02 18:19     ` Robert Thorpe
2006-11-02 13:00 ` David Kastrup

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.