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

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

Re: System operating detection


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

Thierry Volpiatto <address@hidden> writes:

> Andrea Crotti <address@hidden> writes:
>
> Use case:
>
> ,----
> | (case system-type
> |   (gnu/linux "Linux")
> |   (window-nt "windows")
> |   (darwin    "mac")
> |   (t         "other")
> `----
>
>
>
>>
>>

Ah great I didn't know this, so now is
--8<---------------cut here---------------start------------->8---
  (defconst linux nil)
  (defconst mac nil)
  (defconst win nil)
  (defconst other nil)
  
  (case system-type
    (gnu/linux (setq linux t))
    (window-nt (setq mac t))
    (darwin    (setq win t))
    (t         (setq other t)))
--8<---------------cut here---------------end--------------->8---

But maybe could be even better, what if I create the symbol only if
really needed?

Then I could do
--8<---------------cut here---------------start------------->8---
(if (boundp linux)...
--8<---------------cut here---------------end--------------->8---
which probably becomes even longer.
Isn't there a way to automatically define functions or variables?




reply via email to

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