[comp.emacs] Redraw or scroll

lius@banana.ufl.edu (Sying-Syang Liu) (12/16/88)

I am working on UNIX 4.2 Release 3.4 and GNU emacs 18.52.5.

What is the criteria that emacs decides to redraw or scroll up (or down)
a buffer when \C-n is pressed at the bottom of a buffer (or \C-p at the
top of a buffer) is pressed?  Emacs usually scrolls on a "slow" terminal
(with speed <= 19200).

The situation is that I usually telnet (not rlogin) from a machine to
the other.  In that case I will get a speed 38400 (logically not
physically).  Under this speed, emacs usually redraws the buffer when
\C-n is pressed at the bottom of a buffer or \C-p at the top of a
buffer.

I have tried "stty 9600" to reset the terminal (No hardware adjustment
is necessary.  Telnet controls it.)  It works but I have to do it
every time when I log in.  I did not reset the terminal speed in my
.login because we have terminals with different physical speeds here.

I also tried to redefine the function "baudrate" (in emacs).  
It did not work.

How to get the physical speed of a terminal?  
How to tell emacs to scroll (up or down) instead of redrawing.

-- UUCP: ...uflorida!beach!lius
   Internet: lius@ufl.edu
   CSNet:    lius%ufl.edu@relay.cs.net
   Sying-Syang Liu, University of Florida

jr@bbn.com (John Robinson) (12/17/88)

In article <LIUS.88Dec16095911@banana.ufl.edu>, lius@banana (Sying-Syang Liu) writes:

>I am working on UNIX 4.2 Release 3.4 and GNU emacs 18.52.5.
Does that make you a Sun?  Probably doesn't matter for anything below.

>What is the criteria that emacs decides to redraw or scroll up (or down)
>a buffer when \C-n is pressed at the bottom of a buffer (or \C-p at the
>top of a buffer) is pressed?  Emacs usually scrolls on a "slow" terminal
>(with speed <= 19200).
Emacs does a cost computation based on the termcap entries.  If it is
cheaper to simply send all the character to a clear screen (which
generally requires no padding) than to do line inserts and deletes,
which usually requires speed-dependent amounts of padding (more
padding at higher speed), it will do ther redreaw.

>The situation is that I usually telnet (not rlogin) from a machine to
>the other.  In that case I will get a speed 38400 (logically not
>physically).  Under this speed, emacs usually redraws the buffer when
>\C-n is pressed at the bottom of a buffer or \C-p at the top of a
>buffer.
>
>I have tried "stty 9600" to reset the terminal (No hardware adjustment
>is necessary.  Telnet controls it.)  It works but I have to do it
>every time when I log in.
This is what I do.  Not a lot to type; you could alias it to something
really terse (of course, if you forget it and start emacs, you'll have
to quit emacs and restart after fixing the baudrate).  But it could be
automated...

>  I did not reset the terminal speed in my
>.login because we have terminals with different physical speeds here.

>I also tried to redefine the function "baudrate" (in emacs).  
>It did not work.

>How to get the physical speed of a terminal?  
There is a proposal (Internet RFC) to enhance the telnet protocol to
allow passing baudrate info the way it is done in rlogin/rsh.  Don't
know how long this will take to get to the masses.  But why would you
want to use telnet instead of rlogin :-) ?

>How to tell emacs to scroll (up or down) instead of redrawing.

One possibility it to key on the baudrate and terminal type within
tset (see the manual page).  For example, something like (for C shell;
you did say .login, but it is doable in Bourne shell as well):

  set noglob; eval `tset -s -m 'arpanet@38400:vt100nopad' vt100`

where arpanet is the terminal class you start up with from an incoming
telnet, and vt100nopad is a special vt100 entry that has less or no
padding defined.  You can get a special termcap file by modifying a
private copy of /etc/termcap, then setting $TERMCAP to the filename
before running tset (see its manpage).  Or get your system
administrator to make the addition.  You would need to reduce the
padding specs to 1/4 (9600/38400) of their correct values.  If this
isn't possible, or since you have to round up, the emacs rederaw cost
computation will possibly still decide it is better to redraw.  So
there is another hack (don hipboots to wade further) ...

Use tset to map you temporarily to an impossible terminal type in the
telnet case, then isssue the stty conditionally, then call on tset
again to get the right terminal type:

  set noglob; eval `tset -s -m 'arpanet@38400:tty33' vt100`
  if ($TERM == tty33) then
    stty 9600
    set noglob; eval `tset -s vt100`
  fi

Of course, in all of the above I have assumed vt100 is the terminal
you are really using; make the appropriate substitutions.

All in all, I think typing stty 9600 ain't that great a burden...
--
/jr
jr@bbn.com or bbn!jr