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

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

System operating detection


From: Andrea Crotti
Subject: System operating detection
Date: Wed, 11 Aug 2010 11:06:06 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (darwin)

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")
     (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]