Path: utzoo!attcan!uunet!husc6!ukma!gatech!mcnc!rti!xyzzy!meissner
From: meissner@xyzzy.UUCP (Michael Meissner)
Newsgroups: comp.emacs
Subject: Re: Am I using SunView or X-windows?
Message-ID: <932@xyzzy.UUCP>
Date: 26 Jun 88 13:39:35 GMT
References: <8806220303.AA24247@unixb.CEL.FMC.COM> <5724@columbia.edu>
Reply-To: meissner@xyzzy.UUCP (Michael Meissner)
Organization: Data General (Languages @ Research Triangle Park, NC.)
Lines: 58

In article <5724@columbia.edu> agw@columbia.edu (Art Werschulz) writes:
| Hi.
| 
| I would like to be able to setq a variable to one value if my emacs
| was called as an emacstool via SunView (a/k/a suntools) and to another
| value if my emacs was called via X-windows.

I use the following (with some stuff deleted) in my .emacs file:

(defvar terminal-type     (getenv "TERM") "Terminal type.")

(defvar terminal-dg       nil "True if the terminal is a DG terminal.")
(defvar terminal-dec      nil "true if the terminal is a DEC terminal.")
(defvar terminal-sun      nil "True if the terminal is a sun terminal.")
(defvar terminal-suntools nil "True if running under suntools.")
(defvar terminal-x        nil "True if running under X windows.")

(if (string-match "^sun" terminal-type)
    (progn
      (setq terminal-sun t)
      (if (and (fboundp 'sun-window-init)
               (>= (sun-window-init) 0))

		 (progn
		   (setq terminal-suntools t)
		   (global-set-key "\C-z" 'suntools-icon)
		 )
      )
    )

    (if window-system
      (setq terminal-x t))

    (progn
      (if (or (string-match "[dD][1-4][0-9][0-9]" terminal-type)
	      (string-match "605[x3]" terminal-type)
	      (string-match "[gG][35]00" terminal-type))
	  	 (setq terminal-dg t))

      (if (string-match "vt[1-9][0-9][0-9]" terminal-type)
	  	 (progn
		   (setq terminal-dec t)
		   (setq term-setup-hook 'enable-arrow-keys)
		 )
      )

      (setq display-time-day-and-date nil)
      (display-time)
    )
)
Michael Meissner, Data General.

Uucp:	...!mcnc!rti!xyzzy!meissner
Arpa:	meissner@dg-rtp.DG.COM   (or) meissner%dg-rtp.DG.COM@relay.cs.net
-- 
Michael Meissner, Data General.

Uucp:	...!mcnc!rti!xyzzy!meissner
Arpa:	meissner@dg-rtp.DG.COM   (or) meissner%dg-rtp.DG.COM@relay.cs.net