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

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

Re: code listp to determine wich os I'm running on


From: Rusi
Subject: Re: code listp to determine wich os I'm running on
Date: Wed, 29 Jan 2014 18:27:18 -0800 (PST)
User-agent: G2/1.0

On Thursday, January 30, 2014 3:42:58 AM UTC+5:30, Renato wrote:
> Sorry Emanuel...
> what's wrong?

> (if (string= system-type "gnu/linux")
>      (setq percorso-variable "\home\renato\Dropbox\emacs_prof\")
>    (message "fatto"))
>    (if (string= system-type "windows-nt")
>        (setq percorso "c:/doc/Dropbox") ))

> It does,t works... :-(

A very common pattern (in 'normal' languages like C/Java etc) is like this

if cond1
   statement1
else if cond2
   statement2
else statement3

You could use an if in lisp for this, but many people prefer a cond

(cond (cond1 statement1)
      (cond2 statement2)
      (t statement3)
)

Look up
M-: (info "(elisp)Conditionals")
for how to write that -- getting the number of parentheses right is tricky for 
beginners.

Also for other neat shortforms like unless, when etc


reply via email to

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