[comp.emacs] Emulating TECO paging in EMACS

dana@softg.UUCP (Eric Dana) (01/14/88)

Recently I have been working on a project to convert TOPS-20
TECO macros to EMACS Lisp. One of the requirements is to read
(or yank) in a page of an input file at a time. Even though
EMACS (18.49) can handle paging in a buffer, I cannot find a
way to get the page from the input file into the buffer.
Can anyone help? Thanks in advance.


				Eric Dana

quiroz@cs.rochester.edu (Cesar Quiroz) (01/14/88)

From article <772@softg.UUCP> (dana@softg.UUCP (Eric Dana)):
:Recently I have been working on a project to convert TOPS-20
:TECO macros to EMACS Lisp. One of the requirements is to read
:(or yank) in a page of an input file at a time. Even though
:EMACS (18.49) can handle paging in a buffer, I cannot find a
:way to get the page from the input file into the buffer.
:Can anyone help? Thanks in advance.

There are no functions to deal with I/O directly (this is a `to do',
of course).  Perhaps the best approximation with the available
functionality would be:

    1-  Read the whole file into a buffer, put point at the very
        beginning.

    2-  Narrow to the first page.  Do not use narrow-to-page, but
        use the motion commands to find where the page ends.

    3-  On a Y, just change the restriction to the next page.

    4-  On A, narrow-to-page is no good.  You have to compute the
        extent of the new restriction, and do the narrowing
        yourself.

In this way your buffer is always restricted to a number of entire
pages, just those TECO believed were in its buffer.  No more 3K
restrictions, of course...

-- 
Cesar Augusto  Quiroz Gonzalez
Department of Computer Science     ...allegra!rochester!quiroz
University of Rochester            or
Rochester,  NY 14627               quiroz@cs.rochester.edu