5

我安装了 emacs,创建了一个 .emacs.d 目录并创建了一个 init.el 文件:

(require 'package)                                                              
(add-to-list 'package-archives                                                  
             '("melpa" . "http://melpa.milkbox.net/packages/") t)               
(package-initialize)                                                            

(when (not package-archive-contents)                                            
  (package-refresh-contents))                                                   

(defvar my-packages                                                             
  '(starter-kit                                                                 
    starter-kit-bindings                                                        
    starter-kit-lisp                                                            
    clojure-mode                                                                
    color-theme                                                                 
    nrepl))                                                                     

(dolist (p my-packages)                                                         
  (when (not (package-installed-p p))                                           
    (package-install p)))                                                       

(require 'color-theme)                                                          
(color-theme-initialize)                                                        
(color-theme-charcoal-black)                                                    
(color-theme-install-frame-params '((background-color . "black")))              

当我打开 emacs 时,我最终得到了color-theme-charcoal-black颜色,其默认的灰色背景。如果我打开 init.el 和eval-buffer,背景会根据需要变黑。

我怎样才能在不需要的情况下获得这种影响eval-buffer

我也试过:

(add-hook 'after-init-hook 
          '(lambda () (color-theme-install-frame-params 
                       '((background-color . "black"))))

类似于这个问题: https ://superuser.com/questions/481793/permanently-override-background-colour-of-emacs-theme

4

1 回答 1

2

好吧,这不是在 Emacs 24 中设置主题的方法,但您可以修补旧主题使其像新主题一样工作。这是我为自己制作的主题示例,但您可以选择您喜欢的主题并替换值。我还没有完成这个,但它已经接近完成了:)

完成后,将文件保存到 ~/.emacs.d/themes/charcoal-black-theme.el

在你的 .emacs 中:

(add-to-list 'custom-theme-load-path (expand-file-name "~/.emacs.d/themes/"))
(setq custom-enabled-themes '(charcoal-black))

完成后,Emacs 会询问您是否要将主题目录和主题永久添加到启用的主题中。如果您的回答是肯定的,它会在(custom-set-variables ...)

示例主题如下:

http://pastebin.com/S2BHmd5s

于 2012-10-14T21:13:41.443 回答