2009-11-05 55 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,這只是測試系統不會趕上