在终端使emacs使用深色,而不是光字体锁的颜色

问题描述:

我在终端上使用MacOS 10.6上的emacs。我有一个白色的背景。在终端使emacs使用深色,而不是光字体锁的颜色

阅读引用的C++字符串非常困难。他们以浅绿色出现。关键词在绿松石中。

通过cpp.el查找源代码后,我确定使用的是cpp-face-light-name-list而不是cpp-face-dark-name-list。

显然,这个功能应该选择基于背景颜色正确的列表:

(defcustom cpp-face-default-list nil 
    "Alist of faces you can choose from for cpp conditionals.               
Each element has the form (STRING . FACE), where STRING                
serves as a name (for `cpp-highlight-buffer' only)                  
and FACE is either a face (a symbol)                     
or a cons cell (background-color . COLOR)." 
    :type '(repeat (cons string (choice face (cons (const background-color) string)))) 
    :group 'cpp) 

但它似乎并不奏效。

我应该在我的.emacs文件中放置什么,以便获取cpp-face-dark-list而不是cpp-face-light-list?

谢谢!

+0

color-theme怎么样? – YuppieNetworking 2010-04-11 17:33:29

+0

也许明确地设置浅色背景的作品? (set-background-color“white”)? – Patrick 2010-04-11 19:39:18

我有同样的问题,我选择的主题在终端上始终无法读取。答案是使用颜色主题包,正如其他人所说,然后选择在终端Emacs的一个主题,并在自己的窗口中运行的另一个主题为Emacs,就像这样:

(require 'color-theme) 
(setq color-theme-is-global t) 
(if window-system 
    (color-theme-deep-blue) ;; Emacs in own window 
    (color-theme-dark-laptop) ;; Emacs in tty 
) 

在Emacs中,您可以输入M-x color-theme-Tab以获取可用主题的列表。同样,您可以为主要模式添加钩子,以根据您正在编辑的代码类型来更改颜色主题。

可能是值得的,以确保您启用终端颜色: export TERM=xterm-256color

+0

由于他看到淡绿色的字体,我认为可以安全地假设终端中的颜色已启用。 – 2010-04-11 21:36:44

由于建议的意见之一 - 检查出color-theme包。这是一个更为通用的解决方案,例如您的问题,并且比手动调整字体表面更容易使用。

如果您将默认面的前景设置为黑色并将背景设置为白色(M-x customize-group basic-faces),则字体锁将确保所有内容都可以自动读取。如果您需要的只有足够的对比度,才能读取字体锁定,那么您需要设置这两种颜色。

我已经尝试colortheme.el,尤其是与emacs23它往往使事情少,而不是更具可读性,我结束了不得不重新启动,以恢复面设置为不可读的前景/背景组合,并没有重置。

这是另一种方法,如果您在Emacs 23+中使用守护进程模式,这种方法尤其方便。在使用守护进程模式时,有时使用图形客户端,有时使用终端客户端。下面的“片段”试图找出你正在使用的客户端,然后切换到适当的主题(从颜色主题选择)。在emacswiki上找到它。

(require 'color-theme) 
(eval-after-load "color-theme" 
    (color-theme-initialize)) 

;; http://www.emacswiki.org/emacs/ColorTheme#toc10 
;; select theme - first list element is for windowing system, second is for console/terminal 
(setq color-theme-choices 
     '(color-theme-tangotango color-theme-standard)) 

(funcall (lambda (cols) 
      (let ((color-theme-is-global nil)) 
      (eval 
       (append '(if (window-system)) 
        (mapcar (lambda (x) (cons x nil)) 
         cols))))) 
     color-theme-choices) 

(require 'cl) 
(fset 'test-win-sys 
     (funcall (lambda (cols) 
      (lexical-let ((cols cols)) 
       (lambda (frame) 
       (let ((color-theme-is-global nil)) 
       (select-frame frame) 
       (eval 
      (append '(if (window-system frame)) 
       (mapcar (lambda (x) (cons x nil)) 
        cols))))))) 
       color-theme-choices)) 
(add-hook 'after-make-frame-functions 'test-win-sys)