Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Configuration 是否仅对命令行版本的emacs执行.emacs文件中的代码?_Configuration_Command Line_Emacs - Fatal编程技术网

Configuration 是否仅对命令行版本的emacs执行.emacs文件中的代码?

Configuration 是否仅对命令行版本的emacs执行.emacs文件中的代码?,configuration,command-line,emacs,Configuration,Command Line,Emacs,我在Mac上运行Carbon Emacs,我的GUI Emacs有一个非常令人愉快的配色方案。不幸的是,当在终端窗口中运行“emacs”时,它会解析我根文件夹中相同的.emacs文件,这看起来像地狱 那么,有没有一种方法可以有条件地执行.emacs文件中的代码,以便为命令行和“GUI”emacs选择不同的颜色方案 谢谢 您可以使用窗口系统变量来确定是否在窗口环境中运行Emacs。例如,您可以在.emacs.el中添加如下内容: (when window-system (setq defaul

我在Mac上运行Carbon Emacs,我的GUI Emacs有一个非常令人愉快的配色方案。不幸的是,当在终端窗口中运行“emacs”时,它会解析我根文件夹中相同的.emacs文件,这看起来像地狱

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


谢谢

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

(when window-system
  (setq default-frame-alist
    (append
      '((background-color . "#102e4e")
        (background-mode  . dark)
        ...))))
以下是
窗口系统
变量的文档(可通过键入C-h v window system RET在Emacs中查看):

显示所选框架的窗口系统的名称。
该值是一个符号——例如,“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
我得到了桌面的颜色主题,桌面的现代包装和桌面版本的所有新功能,但是,它在终端中。你可以做一些操作系统链接,使新的成为默认的(我不介意)