调整新Emacs 24.3中的术语面

时间:2013-03-27 14:27:27

标签: emacs emacs-faces

如何调整新版Emacs中的term面以获得与ansi-term-color-vector相同的控制?

Emacs 24.3中的new features之一似乎是它改进了控制term缓冲区面的机制,即:

  

现在变量term-default-fg-colorterm-default-bg-color   不赞成使用可自定义的面term

     

您可以自定义如何显示ANSI终端颜色和样式   自定义相应的term-color-COLORterm-color-underline   和term-color-bold面孔。

来自Mastering Emacs的米奇comments the following

  

如果像我一样,你定制ansi-color-names-vector来改变   默认术语颜色我建议你现在切换到使用面孔。该   这里的好消息是,您可以,应该愿意,改变的不仅仅是   每种ANSI颜色的颜色:没有什么可以阻止你强迫   某种颜色的不同字体

与Mickey一样,我也使用ansi-color-names-vector来确保我的term缓冲区的颜色在黑暗主题上看起来很好(例如tango-dark

(setq ansi-term-color-vector [unspecified “black” “red3” “lime green” “yellow3” “DeepSkyBlue?3” “magenta3” “cyan3” “white”])

但现在这会导致错误:

"error in process filter: Invalid face; unspecified" 

尝试使用新面孔term,当我转到M-x describe-face term时,我会看到以下内容:

[] Font Family
[] Font Foundry
[] Width
[] Height
[] Weight
[] Slant
[] Underline
[] Overline
[] Strike-through
[] Box around text
[] Inverse-video
[] Foreground
[] Background
[] Stipple
[x]  Inherit

但是如何调整这些设置以获得使用ansi-term-color-vector获得的相同效果?

更新

我仍然无法修复颜色。这是我为M-x customize-theme tango-dark获得的菜单:

enter image description here

以下是终端中很难看到的颜色/面孔之一的示例:

enter image description here

3 个答案:

答案 0 :(得分:10)

这在Emacs 24.3.1中对我有用,可以设置术语和术语的颜色。只需将颜色更改为您的首选值(相应地调整背景)。

;; term
(defface term-color-black 
  '((t (:foreground "#3f3f3f" :background "#272822"))) 
  "Unhelpful docstring.")
(defface term-color-red
  '((t (:foreground "#cc9393" :background "#272822"))) 
  "Unhelpful docstring.")
(defface term-color-green
  '((t (:foreground "#7f9f7f" :background "#272822"))) 
  "Unhelpful docstring.")
(defface term-color-yellow
  '((t (:foreground "#f0dfaf" :background "#272822"))) 
  "Unhelpful docstring.")
(defface term-color-blue 
  '((t (:foreground "#6d85ba" :background "#272822"))) 
  "Unhelpful docstring.")
(defface term-color-magenta 
  '((t (:foreground "#dc8cc3" :background "#272822"))) 
  "Unhelpful docstring.")
(defface term-color-cyan
  '((t (:foreground "#93e0e3" :background "#272822"))) 
  "Unhelpful docstring.")
(defface term-color-white
  '((t (:foreground "#dcdccc" :background "#272822"))) 
  "Unhelpful docstring.")
'(term-default-fg-color ((t (:inherit term-color-white))))
'(term-default-bg-color ((t (:inherit term-color-black))))

;; ansi-term colors
(setq ansi-term-color-vector
  [term term-color-black term-color-red term-color-green term-color-yellow 
    term-color-blue term-color-magenta term-color-cyan term-color-white])

答案 1 :(得分:4)

在Emacs 24.3中,您需要调整以下面孔:

   ;; term
   `(term-color-black ((t (:foreground ,zenburn-bg
                                       :background ,zenburn-bg-1))))
   `(term-color-red ((t (:foreground ,zenburn-red-2
                                       :background ,zenburn-red-4))))
   `(term-color-green ((t (:foreground ,zenburn-green
                                       :background ,zenburn-green+2))))
   `(term-color-yellow ((t (:foreground ,zenburn-orange
                                       :background ,zenburn-yellow))))
   `(term-color-blue ((t (:foreground ,zenburn-blue-1
                                      :background ,zenburn-blue-4))))
   `(term-color-magenta ((t (:foreground ,zenburn-magenta
                                         :background ,zenburn-red))))
   `(term-color-cyan ((t (:foreground ,zenburn-cyan
                                       :background ,zenburn-blue))))
   `(term-color-white ((t (:foreground ,zenburn-fg
                                       :background ,zenburn-fg-1))))
   '(term-default-fg-color ((t (:inherit term-color-white))))
   '(term-default-bg-color ((t (:inherit term-color-black))))

此代码来自最新版本的Zenburn。 就个人而言,我觉得定制面部的新方法是对使用模糊矢量的改进。

答案 2 :(得分:2)

我建议 M-x customize-group RET term RET
作为自定义这些颜色的最简单入口点。