NVa*_*han 7 macos emacs ubuntu operating-system elisp
我在Mac OS X和Ubuntu上都使用emacs.我的.emacs在两个平台上大致相同,有几行关于本地字体和其他与操作系统相关的东西.正如我通常对我的.emacs文件添加内容,我想以准自动方式同步它们.我的问题是---在Lisp中是否有一种方法可以添加条件过程来检测正在运行的操作系统?像(伪代码)的东西:
If OS X:
run this and that command;
If Linux:
run that other command;
Fi
Run Code Online (Sandbox Code Playgroud)
提前致谢.
NVa*_*han 10
按照bmeric的建议,这个解决方案对我有用:
(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))
)
)
Run Code Online (Sandbox Code Playgroud)