gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 03:40:56 24 4
gpt4 key购买 nike

我在这里在 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/

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