gpt4 book ai didi

基于主机名的elisp条件

转载 作者:行者123 更新时间:2023-12-03 10:56:35 25 4
gpt4 key购买 nike

我在不同的 Linux 系统之间共享一个 .emacs 文件。我想根据我正在运行的系统的主机名执行一个表达式:

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

我想避免检查主机名的一种方法是从 .emacs 中提取系统依赖项,但是在版本控制中使用 .emacs 很方便。欢迎提供其他建议。

最佳答案

system-name变量可能是在低于 25.1 的 Emacs 中实现您正在寻找的内容的最简单方法:

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

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



所以在较新的 Emacs 中使用这个:
(when (string= (system-name) "your.ubuntu.host")
(color-theme-initialize))

关于基于主机名的elisp条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7549978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com