2009-11-05 59 views
6

我在linux盒子和OS X盒子之间共享我的emacs配置文件。但是,当我在配置中为Emacs.app定义特定字体时,配置会中断,然后在Linux上不可用。在elisp中测试平台?

有没有一种方法我可以测试当前平台,然后执行或跳过OS X的具体说明?

回答

8

的elisp的变量system-type是你想要的。所以,你可以写

(if (eq system-type 'darwin) 
    (your-macosx-specific-configuration)) 
3

另一种可能考虑直接的字体正在测试

在我的.emacs

文件我有以下几点:

(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)))))) 

这部作品甚至从控制台的emacs的OS X,这只是测试系统不会赶上