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

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

Re: System operating detection


From: TheFlyingDutchman
Subject: Re: System operating detection
Date: Wed, 08 Dec 2010 15:24:09 -0000
User-agent: G2/1.0

On Aug 11, 2:06 am, Andrea Crotti <andrea.crott...@gmail.com> wrote:
> Is there a way to make this ugly thing:
>
> --8<---------------cut here---------------start------------->8---
>   (defconst sysop
>     (cond
>      ((string-match "linux" system-configuration) "linux")
>      ((string-match "apple" system-configuration) "mac")
>      ((string-match "win" system-configuration) "win")

I am using Windows 7 Home Premium and (from Help->About Emacs) "GNU
Emacs 23.2.1 (i386-mingw-nt6.1.7600)  of 2010-05-08 on G41R2F1", and
the value for system-configuration is "i386-mingw-nt6.1.7600". I guess
they have changed the format of system-configuration for Windows?? For
system-type I have "windows-nt".  Maybe sytem-type is a better
variable to check??


>      (t "other")))
>
>   (defconst linux (string= "linux" sysop))
>   (defconst mac (string= "mac" sysop))
>   (defconst win (string= "win" sysop))
>   (defconst other (string= "other" sysop))
> --8<---------------cut here---------------end--------------->8---
>
> looking better?
> I would like to have all the constants defined (to nil or t) but
> avoiding this ugly repetition.
> One (small) problem is that without the "cond" also "darwin" matches
> "win", so I get a wrong constant...



reply via email to

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