我在Mac上运行Carbon Emacs,我的GUI emacs有一个非常令人满意的配色方案。不幸的是,当在终端窗口中运行“emacs”时,它看起来像是地狱,它会解析我的根文件夹中相同的.emacs文件。仅在命令行版本的Emacs中执行.emacs文件中的代码?
那么,有没有办法在我的.emacs文件中有条件地执行代码,以便我可以为命令行和“GUI”emacs选择不同的配色方案?
谢谢!
我在Mac上运行Carbon Emacs,我的GUI emacs有一个非常令人满意的配色方案。不幸的是,当在终端窗口中运行“emacs”时,它看起来像是地狱,它会解析我的根文件夹中相同的.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可视章3V窗口系统RET):
显示选定框架的窗口系统的名称。
该值是一个符号 - 例如,X窗口的“x”。
如果所选帧位于纯文本终端上,则该值为零。
Mac带有一个真正旧版本的emacs。所以当你在一个终端首先发现版本:
Valideres-MacBook-Pro:be james$ which emacs
/usr/bin/emacs
Valideres-MacBook-Pro:be james$ emacs --version
GNU Emacs 22.1.1
Copyright (C) 2007 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Valideres-MacBook-Pro:be james$ /Applications/Emacs.app/Contents/MacOS/Emacs --version
GNU Emacs 25.1.1
Copyright (C) 2016 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Valideres-MacBook-Pro:be james$ /Applications/Emacs.app/Contents/MacOS/Emacs -nw ~/code/tmp/greatstuff.lsp
Emacs是在桌面版本还可以在终端运行的真的很棒。只需传入“无窗口”的-nw选项即可。所以对我来说我键入:
/Applications/Emacs.app/Contents/MacOS/Emacs -nw ~/code/tmp/greatstuff.lsp
,我得到了桌面的颜色主题,桌面的现代包装和所有的桌面版的新功能,但是,它在终端。你可以做一些操作系统链接,使新的默认(我不能打扰)
干杯。诀窍了。 – MarcWan 2009-12-09 07:30:23