从.emacs设置Emacs 24色主题 [英] Setting Emacs 24 color theme from .emacs

查看:143
本文介绍了从.emacs设置Emacs 24色主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.emacs中有以下代码:

I have the following code in my .emacs:

(if (null window-system)
  (progn
    (require 'color-theme)
    (color-theme-initialize)
    (color-theme-simple-1)))

当我在控制台上打开Emacs时,我可以验证 progn 块运行(通过一个(消息Got here。)),我看到一个闪存,表明颜色主题已经加载,但如果加载,它被别的东西所覆盖。如果在加载后,我打开我的.emacs文件,并使用 C-x C-e 提交上述块,它可以工作。我试过这样做:

When I open Emacs on the console, I can verify that the progn block runs (by a (message "Got here.")), and I see a flash that suggests that the color theme was loaded, but if it was loaded, it is overridden by something else. If, after loading, I open my .emacs file and submit the block above using C-x C-e, it works. I've tried doing:

(add-hook 'after-init-hook
          (lambda ()
            (progn
              (require 'color-theme)
              (color-theme-initialize)
              (color-theme-simple-1))))

但行为相同。

可能与我使用Emacs 24相关,而且这个代码不在我的.emacs中,而是在〜/ Dropbox / .emacs中,它是从我的.emacs加载的。

It may be relevant that I'm using Emacs 24, and that this code is not in my .emacs, but in ~/Dropbox/.emacs, which is loaded from my .emacs.

另外一个注意事项:我尝试过 Mx customize-themes ,但是没有一个在控制台上可以接受。他们或者产生几乎不可读的光主题,或者大部分文字都是看不见的。

An additional note: I've tried M-x customize-themes, but none of those work acceptably on the console. They either produce a nearly unreadable light theme, or most of the text is invisible.

推荐答案

Emacs 24内置了主题,不使用(require'color-theme)之类的语句。如Drew在评论中指出的那样,颜色主题和自定义主题之间存在差异,而新的方向是针对后者。尝试 M-x自定义主题来看看。从.emacs,你可以做一些例如(load-theme'wombat t)

Emacs 24 has built-in theming, which doesn't use statements like (require 'color-theme). As Drew points out in the comments, there are differences between color themes and custom themes, and the new direction is towards the latter. Try M-x customize-themes to take a look. From .emacs, you can do things like (load-theme 'wombat t).

可能还会出现错误。有一件事可能会像这样的事情会改变你的脸 - 也许在你的.emacs文件的自定义面部分。 Emacs的交互式自定义功能自动包括您在设置时遇到的任何主题的颜色信息(包括背景前景),因此这可以使颜色主题变得麻烦。如果这是导致它的原因,你可以设置你喜欢的特定属性,如

It may still be going wrong for you. One thing that can mess it up like this is changing the face -- maybe in the custom-set-faces part of your .emacs file. Emacs's interactive customization automatically includes the color information (both background and foreground) of whatever theme you happen to be using at the time you set it, so this can definitely make trouble with color themes. If that is what's causing it, you can just set the particular attribute you care about with something like

(set-face-attribute 'default nil :height 120)

更改颜色。

这篇关于从.emacs设置Emacs 24色主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆