我在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?
谢谢!
答案 0 :(得分:4)
我遇到同样的问题,我选择的主题在终端上总是不可读的。答案是使用颜色主题包,正如其他人所说,然后在终端中为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
以获取可用主题列表。同样,您可以为主要模式添加钩子,以根据您正在编辑的代码类型更改颜色主题。
答案 1 :(得分:3)
根据其中一条评论中的建议 - 查看color-theme包。对于像你这样的问题来说,这是一个更通用的解决方案,它比手动调整字体更容易使用。
答案 2 :(得分:1)
如果明确将default-face的前景设置为黑色,将background设置为白色(M-x customize-group basic-faces
),则字体锁定将确保所有内容都自动可读。如果您只需要足够的对比度就可以读取字体锁,那么这两种颜色是您需要设置的唯一颜色。
我已经尝试过colortheme.el,特别是对于emacs23,它往往会减少而不是更具可读性,我最终不得不重新启动以恢复设置为不可读的前景/背景组合并且没有重置的面部。
答案 3 :(得分:0)
可能值得确保您的终端启用彩色:
export TERM=xterm-256color
答案 4 :(得分: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)