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

查看:46
本文介绍了从 .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 块是否运行(通过 (message "Got here.")),并且我看到一个flash 表明颜色主题已加载,但如果已加载,则会被其他内容覆盖.如果在加载后,我打开我的 .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 中,而是在从我的 .emacs 加载的 ~/Dropbox/.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.

附加说明:我已经尝试了 M-x 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 Customize-themes 看看.在 .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 文件的 custom-set-faces 部分.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)

这将改变字体大小而不改变颜色.

That will change the font size without changing the colors.

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

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