2

我在带有终端的 MacOS 10.6 上使用 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?

谢谢!

4

5 回答 5

4

我有同样的问题,我选择的主题在终端上总是不可读。答案是使用 color-theme 包,正如其他人所说,然后在终端中为 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以获取可用主题的列表。同样,您可以为主要模式添加挂钩,以根据您正在编辑的代码类型更改颜色主题。

于 2010-05-16T19:25:04.353 回答
3

正如其中一条评论所建议的那样 - 查看color-theme包。对于像您这样的问题,它是一种更通用的解决方案,并且比手动调整字体更容易使用。

于 2010-04-11T21:35:45.777 回答
1

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

我已经尝试过 colortheme.el,尤其是使用 emacs23 时,它往往会使事情变得更少而不是更具可读性,我最终不得不重新启动以恢复它设置为不可读的前景/背景组合并且没有重置的面孔。

于 2010-04-12T01:13:09.047 回答
0

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

于 2010-04-11T18:14:44.947 回答
0

这是另一种方法,如果您在 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)
于 2010-06-01T14:27:27.690 回答