configuration - 仅针对 Emacs 的命令行版本执行 .emacs 文件中的代码?

标签 configuration command-line emacs

我在这里在 Mac 上运行 Carbon Emacs,我的 GUI emacs 有一个非常令人愉悦的配色方案可供使用。不幸的是,在终端窗口中运行“emacs”时看起来很糟糕,它会解析我根文件夹中的相同 .emacs 文件。

那么,有没有办法有条件地在我的 .emacs 文件中执行代码,以便我可以为命令行和“GUI”emacs 选择不同的配色方案?

谢谢!

最佳答案

您可以使用 window-system 变量来确定您是否在窗口环境中运行 Emacs。例如,您可以在 .emacs.el 中添加如下内容:

(when window-system
  (setq default-frame-alist
    (append
      '((background-color . "#102e4e")
        (background-mode  . dark)
        ...))))

这是 window-system 变量的文档(可在 Emacs 中通过键入 C-h v window-system RET 查看):

Name of window system through which the selected frame is displayed.
The value is a symbol--for instance, `x' for X windows.
The value is nil if the selected frame is on a text-only-terminal.

关于configuration - 仅针对 Emacs 的命令行版本执行 .emacs 文件中的代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1866934/

相关文章:

emacs - emacs 前缀参数的目的/用法是什么?

vim - 为什么 gedit 和 vim 对用户隐藏最后的换行符?

PHP Composer : No Dev Mode that Sticks

grails - 是否可以从Grails中的外部化配置文件加载更多配置文件?

Bash 命令行 Tab 完成冒号字符

java - 从命令行执行jar时出错

java - 我如何执行命令行参数 "java -Djava.security.manager GetProps"但使用 NetBeans

tomcat - 有什么方法可以使用JAVA自动清除tomcat垃圾值

java - 在 Eclipse 中安装【java 库】

windows - 在 emacs 中创建别名?