[comp.emacs] Using Emacs terminal mode w/SYSV

craig@ncrcpx.UUCP (R. Craig Peterson) (12/30/87)

Is there a way (hack or otherwise) to get emacs to generate a terminfo
entry for the terminal description it needs for terminals associated
with various windows rather than just putting a termcap entry into the
environment?  This would work well with V7, or BSD, but doesn't get
along too well with most of my USG applications.
-- 
R. Craig Peterson		"Next time someone asks you if you're a god
ncrlnk!ncrcam!ncrcpx!craig	 say YES!!"
N8INO					Ghost Busters
E Pluribus Unum 	(NSA stuff - terrorist, DES, cipher, secret, NRO, CIA)

allbery@axcess.UUCP (Brandon S. Allbery) (01/03/88)

There's one small problem with creating terminfo entries on the fly:  you
can't stuff a terminfo description into an environment variable, you MUST
write it to a file in a terminfo-style hierarchical database (i.e.
$TERMINFO/e/emacs or similar).  Probably using "tic" is safest for this,
especially since it will create directories, etc... but, you need to create a
unique terminal entry for every terminal-mode window (termcap doesn't need
this, as it won't look in /etc/termcap if there's a valid termcap entry in
$TERMCAP).

It looks to me like it's more than slightly ugly and unlikely to function
properly under all circumstances.  And G*d knows how you'd handle a resized
window (of course, the same applies to 4.2BSD, so *someone* must have dealt
with it, but I doubt it'd be portable).
-- 
 ___  ________________,	Brandon S. Allbery	       cbosgd \
'   \/  __   __,  __,	aXcess Company		       mandrill|
 __  | /__> <__  <__	6615 Center St. #A1-105		       !ncoast!
/  ` | \__. .__> .__>	Mentor, OH 44060-4101	       necntc  | axcess!allbery
\___/\________________.	Moderator, comp.sources.misc   hoptoad/

denny@mcmi.UUCP (Dennis Page) (01/06/88)

In article <126@axcess.UUCP> allbery@axcess.UUCP (Brandon S. Allbery) writes:
>[...] but, you need to create a
>unique terminal entry for every terminal-mode window (termcap doesn't need
>this, as it won't look in /etc/termcap if there's a valid termcap entry in
>$TERMCAP).

Actually, it's not quite as bad as that.
First, you write (and tic) a terminfo entry for the fixed data like:

emacs-virtual,
	bel=^P^G, clear=^P\f, cr=^P^A, cub1=^P^B, cud1=\n,
	cup=^P=%p1%'\s'%+%c%p2%'\s'%+%c, dch=^Pd%p1%'\s'%+%c,
	dch1=^Pd!, dl=^P^K%p1%'\s'%+%c, dl1=^P^K!, ed=^PC,
	el=^Pc, ich=^P_%p1%'\s'%+%c, ich1=^P_!,
	il=^P^O%p1%'\s'%+%c, il1=^P^O!, ind=\n, nel=\n,

Then you set environment variables "TERM", "LINES" and "COLUMNS" to
"emacs-virtual", te-height, and te-width respectively.  You can do
this by hand, in your .cshrc, or (feeling adventurous?) by hacking
on terminal.el.  If anyone does the mods to terminal.el, please send
me a copy.  It is on my list of things to do, but rather far down.

You still have the problem of no pty drivers...

If anyone has source to pty drivers (especially sysV), please,
please, send me a copy!  I'm willing to port!
-- 
Denny Page

Martha, the Clones are loose again!

greg@xios.XIOS.UUCP (Greg Franks) (01/14/88)

There have been comments about terminfo entries for terminal mode in GNU
emacs.  Terminal mode sets the enviroment variable TERMCAP each time it
is invoked.  The number of lines and columns are set based on the window
size.  This trick doesn't work on Sys V because "termcap" entries are
compiled into the terminfo database; TERMCAP is ignored.  However,
there is an out: the environment variables LINES and COLUMNS override
the terminfo values for the TERM in use.  So, here is the terminfo entry
(courtesy of captoinfo)

emacs-virtual,
	xon,
	cols#78, lines#22,
	bel=^P^G, clear=^P\f, cr=^P^A, cub1=^P^B, cud1=\n,
	cup=^P=%p1%'\s'%+%c%p2%'\s'%+%c, dch=^Pd%p1%'\s'%+%c,
	dch1=^Pd!, dl=^P^K%p1%'\s'%+%c, dl1=^P^K!, ed=^PC,
	el=^Pc, ich=^P_%p1%'\s'%+%c, ich1=^P_!,
	il=^P^O%p1%'\s'%+%c, il1=^P^O!, ind=\n, nel=\n,

Tic this definition.  Don't change the name "emacs-virtual" unless you
also change the name in terminal.el.  

Change terminal.el so that it emits the appropriate magic to set LINES
and COLUMNS (sorry - I haven't gotten to that part of job yet - my lisp
is non-existant....). 

-----
I have noticed that not all programs that use curses will run: they
object to missing capabilities.  I have not yet determined which
capabilities are missing.  If anyone has any suggestions (and
enhancements to terminal mode), please respond.

Thanks

-- 
Greg Franks             XIOS Systems Corporation, 1600 Carling Avenue,
(613) 725-5411          Ottawa, Ontario, Canada, K1Z 8R8
utzoo!dciem!nrcaer!xios!greg    "There's so much to sea in Nova Scotia"