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:43:35 -0800 (PST)
User-agent: G2/1.0

On Thursday, January 30, 2014 12:11:00 AM UTC+5:30, Renato wrote:
> Hi,
> I'm looking for some code to insert in my .emacs to determine wich s.o 
> I'm running.
> 've foud this code:
> _______________________________________
> ;; check OS type (cond((string-equalsystem-type"windows-nt") ; Microsoft 
> Windows (progn(message"Microsoft Windows") ) ) 
> ((string-equalsystem-type"darwin") ; Mac OS X (progn(message"Mac OS X") 
> ) ) ((string-equalsystem-type"gnu/linux") ; linux (progn(message"Linux") 
> ) ) )
> ________________________
> but I do't know lisp (I will learn it, of course...but not now...)
> I've understand that if I'm running Linux if I press F1-e, in the buffer 
> I can read "linux".

> But What do I have to do to set a particular path (setq load-path... to 
> start from if I click
> for my C-x f in emacs on linux or win?

Heres your code written a little more legibly and which you are trying to write
as using if

(cond ((string= system-type "windows-nt") (message "Microsoft Windows"))
      ((string= system-type "darwin")     (message "Darwin"))
      ((string= system-type "gnu/linux")  (message "Gnu/Linux"))
      (t                                  (message "Unknown system")))

[Ive only checked on linux]

Now you can replace those (message "...") calls with what you like

Mind you though setting load-path with a setq is a BAD idea
usually better to make small additions like this

(add-to-list 'load-path "~/.emacs.d/downloads")

Replace the string with whatever you want to add to the load-path


reply via email to

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