Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.emacs code to identify OS?

I'm using emacs on both Mac OS X and Ubuntu. My .emacs is mostly the same for both platforms, with a couple of lines concerning local fonts and other OS-related stuff. As I usually do additions to my .emacs files, I would like to sync them in a quasi-automatic manner. My question is---is there a way in Lisp to add a conditional procedure to detect the running OS? Something like (pseudo-code):

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

Thanks in advance.

like image 233
NVaughan Avatar asked Nov 10 '12 22:11

NVaughan


1 Answers

Following bmeric's advice, 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))
    )
)
like image 99
NVaughan Avatar answered Sep 19 '22 14:09

NVaughan