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

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

问题描述

如何在新的Emacs中调整术语,以获得与 ansi-term-color-vector



新功能似乎是改变了控制术语 buffers,即:


变量 term-default-fg-color term-default-bg-color 现在
已被弃用,有利于可自定义面孔术语



您可以自定义如何显示ANSI终端颜色和样式
自定义相应的术语颜色COLOR 术语颜色下划线
术语颜色粗体面。


Mickey from Mastering Emacs 注释以下


如果,像我一样,您自定义 ansi-color-names-vector 以更改
默认术语颜色,我建议您现在切换到使用面。
这里的好消息是,您可以想要改变不只是每个ANSI颜色的
颜色:没有什么阻止你强制
a某些颜色的不同字体


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

 (setq ansi-term-color-vector [unspecifiedblackred3lime greenyellow3DeepSkyBlue?3magenta3 blue3white])

但是,这样会导致错误:

 过程过滤器中的错误:无效的面孔;未指定的

为了尝试使用新面孔术语,当我去 Mx描述面部术语,我看到如下:

  [] Font Family 
[] Font Foundry
[ ]宽度
[]高度
[]重量
[]斜度
[]下划线
[] Overline
[] Strike-through
[]围绕文本框b $ b []反视频
[]前景
[]背景
[] Stipple
[x]继承
pre>

但是如何调整这些设置以获得与 ansi-term-color-vector



更新



我仍然无法修复颜色。这是我获得的菜单, Mx自定义主题探戈黑暗





这里是一个颜色/面对难以看到的终端:



           
               

解决方案

这在Emacs 24.3.1中为我设置了术语和ansi-term的颜色。只需将颜色更改为您的首选值(背景相应调整)。

  ;; ($)
(t(:前台#3f3f3f:背景#272822)))
无效的docstring)
(defface term-color-red
'((t(:foreground#cc9393:background#272822)))
无帮助的docstring)
(defface term-color -green
'((t(:foreground#7f9f7f:background#272822)))
无用的docstring)
(defface term-color-yellow
'((t(:foreground#f0dfaf:background#272822)))
无帮助的docstring)
(defface term-color-blue
' ((前景#6d85ba:背景#272822)))
无用的docstring)
(defface term-color-magenta
' (b)((前台#93e0e3:背景#)
(无效的docstring))
(defface term-color-cyan
'
(defface term-color-white
'((t(:foreground#dcdccc:background#272822))
(无效的docstring) )
无帮助的docstr ($)($)
'(term-default-fg-color((t(:inherit term-color-white))))
'(term-default-bg-color继承术语 - 黑色))))

;; ansi-term颜色
(setq ansi-term-color-vector
[term term-color-black term-color-red term-color-green term-color-yellow
term-color蓝色术语 - 颜色 - 品红色术语 - 颜色 - 青色术语 - 颜色 - 白色])


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

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.:

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

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 comments the following:

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

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

But this now results in an error:

"error in process filter: Invalid face; unspecified" 

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

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

Update

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:

                             

解决方案

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天全站免登陆