help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

initialization elisp for platform ID


From: Tom Roche
Subject: initialization elisp for platform ID
Date: Sat, 03 Nov 2001 13:49:06 -0500

I'm running on enough platforms now that I spend too much time
versioning .emacs. I want instead to have one .emacs, which will
detect the platform on which it's running and behave accordingly. I
have the following in my .emacs:

> ;; Are we running XEmacs or Emacs?
> (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))

> ;; system testing. Note various tests in use within
> ;; http://home.swipnet.se/Karlssons/Leif/_EMACS
> ;; He tests 'window-system. There is also a 'window-system-version.

> ; Are we running on X Windows? 
> (defvar running-on-x (eq window-system 'x))

> ; Are we running on M$ Windows? 
> (defvar running-on-windows (eq window-system 'w32))

Unity is the main NCSU user environment, running win32, solaris,
redhat, and mac clients on afs, netware, and kerberos. It has enough
peculiarities to deserve its own flags and code :-)

> ; Are we running on Unity Windows? 
> (defvar running-on-unity-windows (eq (getenv "OU") 'ZenLab))

> ;; Are we running on a linux? 
> (defvar running-on-linux (string-match "linux" (getenv "OSTYPE")))

> ; Are we running on Solaris?
> (defvar running-on-solaris (string-match "solaris" (getenv "OSTYPE")))

> ; Are we running on Unity Solaris? 
> (defvar running-on-unity-solaris
>   (and running-on-solaris
>        (string-match "unity.ncsu.edu" (getenv "HOST"))))

> ; Are we running in a terminal/in a shell?
> (defvar running-on-shell (eq window-system nil))

and then I'll do stuff like

> (if (eq window-system 'w32)
>     (progn

But what I'm presently wondering is:

* Why doesn't

  (defvar running-on-solaris (string-match "solaris" (getenv "OSTYPE")))

  work? It returns nil even when (much cruft deleted)

> /ncsu/tlroche> printenv
> HOST=uni01du.unity.ncsu.edu
> GROUP=ncsu
> MACHTYPE=sparc
> OSTYPE=solaris
> VENDOR=sun
> HOSTTYPE=sun4

  FWIW,

  (defvar running-on-solaris (eq (getenv "OSTYPE") 'solaris))

  also fails, but running-on-<linux | <<unity-> | windows> all work.

* Does 'window-system-version really mean anything for any window
  system besides X?

* Are there better ways to do what I'm doing?

Your assistance is appreciated, Tom_Roche@ncsu.edu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]