[comp.emacs] Termcaps in Gnu Emacs

drw@cullvax.UUCP (Dale Worley) (12/17/86)

I would like to play with a termcap for a particular terminal.  I
don't want to have to edit /etc/termcap to do this.  But it seems that
Gnu Emacs (at least version 17) only looks at the TERM environment
variable.  Could it be altered so that it uses TERMCAP environment
variable if it is present, and if not, then the TERM variable?

Dale
-- 
Dale Worley		Cullinet Software
UUCP: ...!seismo!harvard!mit-eddie!cullvax!drw
ARPA: cullvax!drw@eddie.mit.edu

swalton@well.UUCP (Stephen R. Walton) (12/18/86)

In article <658@cullvax.UUCP> drw@cullvax.UUCP (Dale Worley) writes:
>I would like to play with a termcap for a particular terminal.  I
>don't want to have to edit /etc/termcap to do this.  But it seems that
>Gnu Emacs (at least version 17) only looks at the TERM environment
>variable.  Could it be altered so that it uses TERMCAP environment
>variable if it is present, and if not, then the TERM variable?
>
this isn't quite true.  The logic is: check the TERMCAP environment
variable.  If it is set and the value does not begin with a slash (/),
assume it is a TERMCAP entry and see if it matches what is set in the
TERM variable.  If it is set and the name does begin with a slash, then
it is the name of the TERMCAP file.

My .login contains something like
	echo -n "Terminal? "
	set term=$<
	fgrep "$term|" ~/.termcap >/dev/null
	if ($status == 0) then
		setenv TERMCAP ~/.termcap
	else
		setenv TERMCAP /etc/termcap
	endif
	eval `tset -sQ`
which reads a line from stdin to get the terminal type, looks in my
personal termcap file (~/.termcap) for an entry with that name, sets
TERMCAP to point there if it finds it or to /etc/termcap if it
doesn't, then use tset to set the TERMCAP environment variable to the
actual entry for my terminal.  This last step isn't strictly necessary,
but speeds up access tremendously.
						Steve Walton
					ametek!walton@csvax.caltech.edu
					walton@caltech.bitnet
					...!seismo!cit-vax!ametek!walton

earleh@dartvax.UUCP (Earle R. Horton) (12/19/86)

In article <658@cullvax.UUCP>, drw@cullvax.UUCP (Dale Worley) writes:
> I would like to play with a termcap for a particular terminal.  I
> don't want to have to edit /etc/termcap to do this.  But it seems that

     This is how I do it (environment: 4.3 BSD),

setenv "TERMCAP" "/people1/earleh/.termcap"

     Then put the experimental termcap entries in the file (/people1/earleh 
is me) and Gnu Emacs or any other program will get the descriptions from
your private termcap file, rather than from /etc/termcap.

bzs@bu-cs.BU.EDU (Barry Shein) (12/19/86)

>I would like to play with a termcap for a particular terminal.  I
>don't want to have to edit /etc/termcap to do this.  But it seems that
>Gnu Emacs (at least version 17) only looks at the TERM environment
>variable.  Could it be altered so that it uses TERMCAP environment
>variable if it is present, and if not, then the TERM variable?
>
>Dale

Gnu Emacs uses the TERMCAP variable, look in src/termcap.c, tgetent().

Or (easier), just set your TERMCAP variable to the full path name
(ie. starting with a '/') to the file in which you have put your
experimental TERMCAP entry:

For csh:
		setenv TERMCAP /usr/myname/termcap.test	# whatever file/path
for sh:
		TERMCAP=/usr/myname/termcap.test	# ditto
		export TERMCAP

and see if it doesn't "take" (apologies if you knew this, but this is
all true under 17.64 so something else must need explaining, perhaps
you're confusing what's going on the lisp files and startup.el and the
C source that does what you're referring to?)

	-Barry Shein, Boston University