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

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

Re: System operating detection


From: Thierry Volpiatto
Subject: Re: System operating detection
Date: Wed, 11 Aug 2010 13:58:48 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> Is there a way to make this ugly thing:
>
>   (defconst sysop
>     (cond
>      ((string-match "linux" system-configuration) "linux")
>      ((string-match "apple" system-configuration) "mac")
>      ((string-match "win" system-configuration) "win")
>      (t "other")))
>   
>   (defconst linux (string= "linux" sysop))
>   (defconst mac (string= "mac" sysop))
>   (defconst win (string= "win" sysop))
>   (defconst other (string= "other" sysop))
>
> 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...

Use case:

,----
| (case system-type
|   (gnu/linux "Linux")
|   (window-nt "windows")
|   (darwin    "mac")
|   (t         "other")
`----



>
>

-- 
Thierry Volpiatto
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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