在新的 Emacs 24.3 中调整术语面 [英] Adjusting term faces in the new Emacs 24.3

查看:13
本文介绍了在新的 Emacs 24.3 中调整术语面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I adjust the term face in the new Emacs to get the same control that was possible with ansi-term-color-vector?

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

One of the new features in Emacs 24.3 seems to be that it revamps the mechanism to control the face of term buffers, i.e.:

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

The variables term-default-fg-color and term-default-bg-color are now deprecated in favor of the customizable face term.

您可以通过以下方式自定义如何显示 ANSI 终端颜色和样式自定义对应的term-color-COLORterm-color-underlineterm-color-bold 面孔.

You can customize how to display ANSI terminal colors and styles by customizing the corresponding term-color-COLOR, term-color-underline and term-color-bold faces.

Mickey from Mastering Emacs 评论以下内容:

Mickey from Mastering Emacs comments the following:

如果像我一样,您自定义了 ansi-color-names-vector 以更改默认术语颜色我建议您现在改用面部.这好消息是你可以,应该希望,改变不仅仅是每个 ANSI 颜色的颜色:没有什么可以阻止你强迫某些颜色的不同字体

If, like me, you customized ansi-color-names-vector to change the default term colours I suggest you switch to using the faces now. The good news here is you can, should desire to, change more than just the colours for each ANSI Color: there’s nothing stopping you from forcing a different font for certain colours

像 Mickey 一样,我也使用 ansi-color-names-vector 来确保我的 term 缓冲区的颜色在深色主题(例如 探戈黑暗)

Like Mickey, I was also using ansi-color-names-vector to make sure that the color of my term buffers looked well on dark themes (e.g. 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" 

尝试使用新的face term,当我去M-x describe-face term时,看到如下:

In an attempt to use the new face term, when I go to M-x describe-face term, I see the following:

[] 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 达到的相同效果?

But how do I adjust these settings to get the same effect I achieved using ansi-term-color-vector?

我仍然无法修复颜色.这是我为 M-x 自定义主题探戈暗色获得的菜单:

I am still unable to fix the colors. Here is the menu that I get for M-x customize-theme tango-dark:

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

And here is an example of one of the colors/faces in a terminal that are hard to see:

               

                             

推荐答案

这在 Emacs 24.3.1 中对我有用,可以设置 term 和 ansi-term 的颜色.只需将颜色更改为您喜欢的值(相应地调整背景).

This worked for me in Emacs 24.3.1 to set the colors of term and ansi-term. Just change the colors to your preferred values (with the background adjusted accordingly).

;; 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])

这篇关于在新的 Emacs 24.3 中调整术语面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆