[net.emacs] GNU Emacs with X Windows

desj@brahms (David desJardins) (10/19/86)

Can someone explain how GNU Emacs handles X Windows?  In particular, suppose
I run 'xinit xtools' where xtools is a program that forks off certain X
applications, including emacs.  I have set DISPLAY to be 'unix:0'.

What I really don't understand is that it *does* work if I first set TERM
to 'xterm'.  Why should it matter what terminal type I am running??  I am
almost certain that emacs (quite properly) writes directly to the X window,
rather than using a terminal emulator like xterm.

The only thing that I can think of is that it is checking my terminal type
to see if I am really running X!  Is it really possible that it would do
this?  This is a truly awful way to go about things, in that (among other
things) it assumes that only one particular terminal emulator will be used
from inside X.

I suppose I will dig into the source if I have to, and see for myself what
it is doing; I am just hoping that someone who knows how it works can let
me know what is going on and save me a lot of effort.  And this seems like
something that could be of interest to other people -- I'm not sure how
many people out there are really using X...

   -- David desJardins
	...!ucbvax!brahms!desj
	desj@brahms.BERKELEY.EDU
	brahms!desj@ucbvax.BERKELEY.EDU

rlk@mit-trillian.MIT.EDU (Robert L Krawitz) (10/19/86)

In article <34@cartan.Berkeley.EDU> desj@brahms (David desJardins) writes:
>Can someone explain how GNU Emacs handles X Windows?  In particular, suppose
>I run 'xinit xtools' where xtools is a program that forks off certain X
>applications, including emacs.  I have set DISPLAY to be 'unix:0'.
>
>What I really don't understand is that it *does* work if I first set TERM
>to 'xterm'.  Why should it matter what terminal type I am running??  I am
>almost certain that emacs (quite properly) writes directly to the X window,
>rather than using a terminal emulator like xterm.
>
>The only thing that I can think of is that it is checking my terminal type
>to see if I am really running X!  Is it really possible that it would do
>this?  This is a truly awful way to go about things, in that (among other
>things) it assumes that only one particular terminal emulator will be used
>from inside X.
>
>I suppose I will dig into the source if I have to, and see for myself what
>it is doing; I am just hoping that someone who knows how it works can let
>me know what is going on and save me a lot of effort.  And this seems like
>something that could be of interest to other people -- I'm not sure how
>many people out there are really using X...
>
The current version of gnuemacs looks at the value of the environment
variable TERM to determine whether or not to run under X.  It was
pointed out to me that this is not the correct way to do it; this is
an artifact of an older implementation.

I'll fix this as soon as I have time to do so; it's a simple fix.

For those people who wish to take a look at it for themselves, the
code is in emacs.c in the function main().  The code around
getenv("TERM") is the part that needs to be changed.  There may be one
or two other places that also need to be fixed; fixing the code in
emacs.c should suffice for anyone who needs to fix it temporarily.
-- 
Robert^Z