tags:

views:

89

answers:

2

I'm sharing my emacs configuration files between a linux box and an OS X box. The config breaks however when I define a specific font for Emacs.app in the config which is then not available on linux.

Is there a way I can test for the current platform and then execute or skip the OS X specific instructions?

+4  A: 

The elisp variable system-type is what you want. So you can write

(if (eq system-type 'darwin)
    (your-macosx-specific-configuration))
Laurynas Biveinis
+2  A: 

another possibility to consider is testing directly for the font

in my .emacs file I have the following:

(let ((prefered-fonts '("-apple-espresso mono-medium-r-normal--0-0-0-0-m-0-iso10646-1")))
  (dolist (font prefered-fonts)
    (if (and (functionp 'x-list-fonts) (x-list-fonts font))
      (progn
        (add-to-list 'initial-frame-alist (cons 'font font))
        (add-to-list 'default-frame-alist (cons 'font font))))))

this works even from console emacs in OS X, which just testing for the system wouldn't catch

cobbal