unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* System operating detection
@ 2010-08-11  9:06 Andrea Crotti
  2010-08-11  9:22 ` Richard Riley
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andrea Crotti @ 2010-08-11  9:06 UTC (permalink / raw)
  To: help-gnu-emacs

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...




^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <mailman.3.1281517588.2982.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2010-08-16 21:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-11  9:06 System operating detection Andrea Crotti
2010-08-11  9:22 ` Richard Riley
2010-08-11 10:19   ` Andrea Crotti
2010-08-11 11:58 ` Thierry Volpiatto
2010-08-11 12:58   ` Andrea Crotti
     [not found]   ` <mailman.1.1281531533.2853.help-gnu-emacs@gnu.org>
2010-08-11 14:27     ` Pascal J. Bourguignon
2010-08-16 21:53 ` Oleksandr Gavenko
     [not found] <mailman.3.1281517588.2982.help-gnu-emacs@gnu.org>
2010-08-11 11:13 ` TheFlyingDutchman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).