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

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

Re: System operating detection


From: Oleksandr Gavenko
Subject: Re: System operating detection
Date: Tue, 17 Aug 2010 00:53:38 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0

On 2010-08-11 12:06, Andrea Crotti 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")
      (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...

I wrote blog article about useful checks in .emacs:

http://brain-break.blogspot.com/2010/08/determining-running-environment-and.html

---
Best regards!




reply via email to

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