.emacs to determine the OS?

I use emacs for both Mac OS X and Ubuntu. My .emacs are basically the same for both platforms, with a few lines relative to local fonts and other OS related materials. Since I usually make additions to my .emacs files, I would like to synchronize them in quasi-automatic mode. My question is, is there a way in Lisp to add a conditional procedure to detect the operating system? Something like (pseudo code):

If OS X: run this and that command; If Linux: run that other command; Fi 

Thanks in advance.

+7
source share
2 answers

Following the bmeric tips, this solution worked for me:

 (cond ((string-equal system-type "gnu/linux") ;; window size (add-to-list 'default-frame-alist '(left . 0)) (add-to-list 'default-frame-alist '(top . 0)) (add-to-list 'default-frame-alist '(height . 32)) (add-to-list 'default-frame-alist '(width . 70)) ) ((string-equal system-type "darwin") ;; window size (add-to-list 'default-frame-alist '(left . 0)) (add-to-list 'default-frame-alist '(top . 0)) (add-to-list 'default-frame-alist '(height . 63)) (add-to-list 'default-frame-alist '(width . 100)) ) ) 
+9
source

You can use the system-type variable.

+8
source

All Articles