开发者

elisp conditional based on hostname

开发者 https://www.devze.com 2023-04-08 04:15 出处:网络
I have a shared .emacs file between different Linux s开发者_开发问答ystems.I would like to execute an expression based on the hostname of the system I\'m running:

I have a shared .emacs file between different Linux s开发者_开发问答ystems. I would like to execute an expression based on the hostname of the system I'm running:

(color-theme-initialize)  ;; required for Ubuntu 10.10 and above.

I suppose one way to avoid checking the hostname would be to factor out the system dependencies from .emacs, but it's been convenient having .emacs in version control. Alternative suggestions are welcome.


The system-name variable might be the simplest way to achieve what you're looking for in Emacs below 25.1:

(when (string= system-name "your.ubuntu.host")
  (color-theme-initialize))

This variable is obsolete since 25.1; use (system-name) instead

So in newer Emacs use this:

(when (string= (system-name) "your.ubuntu.host")
  (color-theme-initialize))
0

精彩评论

暂无评论...
验证码 换一张
取 消