简体   繁体   English

emacs ansi-term 背景色

[英]emacs ansi-term background color

I'm having a problem changing the background color in ansi-term (and also term - but shell is fine).我在更改 ansi-term(以及 term - 但 shell 很好)中的背景颜色时遇到问题。 It displays colors fine from output but the background color of the out put is always white.它显示输出的颜色很好,但输出的背景颜色始终为白色。 Not the entire buffer, but just under actual characters that have been outputted.不是整个缓冲区,而是在已输出的实际字符下。 If I do something like如果我做类似的事情

(add-hook 'ansi-term-mode-hook
    (lambda ()
        (set-background-color "purple")))

This changes the buffer's background color, but the output just overrides it with its own background color - white.这会改变缓冲区的背景颜色,但输出只是用它自己的背景颜色 - 白色覆盖它。

I've also tried to find the face that it is using so I can customize it by doing Cu Cx = to get the info on the face at the point -- which works for everything else and even points you where to change it which is nice... but in ansi term i get this我还尝试找到它正在使用的人脸,因此我可以通过执行Cu Cx =来自定义它以获取该点上的人脸信息 - 这适用于其他所有内容,甚至指向您更改它的位置很好......但在ansi术语中我明白了

    character: m (109, #o155, #x6d)
preferred charset: ascii (ASCII (ISO646 IRV))
   code point: 0x6D
       syntax: w    which means: word
     category: .:Base, a:ASCII, l:Latin, r:Roman
  buffer code: #x6D
    file code: #x6D (encoded by coding system utf-8)
      display: by this font (glyph code)
xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1 (#x50)

Character code properties: customize what to show
  name: LATIN SMALL LETTER M
  general-category: Ll (Letter, Lowercase)

There are text properties here:
  face                 (:background "white" :foreground "black")

[back]

I don't know where this is getting set.我不知道这是在哪里设置的。 face (:background "white" :foreground "black")脸(:背景“白色”:前景“黑色”)

Also, I've used multiple themes that I know have the ansi-term-color-vector (zenburn, etc).此外,我使用了多个我知道具有 ansi-term-color-vector(zenburn 等)的主题。 I've gone through every sample in customize-face and its no where in there either.我已经浏览了 custom-face 中的每个样本,但它也没有。

Any thoughts on how to override/set this so it's just the transparent (or unset) background like everything else?关于如何覆盖/设置它的任何想法,所以它只是像其他一切一样的透明(或未设置)背景?

Thanks for any help.谢谢你的帮助。

I'm not sure if I understand what's going on in your setup but you can try setting:我不确定我是否了解您的设置中发生了什么,但您可以尝试设置:

(setq term-default-bg-color "#211E1E")
(setq term-default-fg-color "#AAAAAA")

Try it from scratch buffer start a new term and check.从头开始尝试缓冲区开始一个新术语并检查。

user178399's reply was entirely correct 10 years ago. user178399 的回复在 10 年前完全正确。 As of v24.3, this pair of variables has been deprecated in favor of customizing the term face.从 v24.3 开始,这对变量已被弃用,以支持自定义term face。 In fact, in Emacs 25.6 (Debian 10 distro, x64), setting these variables no longer has any effect whatsoever, while changing the face does.事实上,在 Emacs 25.6(Debian 10 发行版,x64)中,设置这些变量不再有任何影响,而改变面孔则有。

If (or rather when, as the variables are already broken, at least here), do not forget to remove their settings from your init file (usually ~/.emacs ) or reset their customization.如果(或者更确切地说,因为变量已经损坏,至少在这里),不要忘记从您的 init 文件(通常是~/.emacs )中删除它们的设置或重置它们的自定义。

Just a heads-up, in case you are searching why the default fore/background settings suddenly turned angry and insubordinate upon you after an upgrade...只是提醒一下,如果您正在搜索为什么默认的前景/背景设置在升级后突然变得愤怒和不服从...

What puzzles me is that I still have to change the background of the ansi-term buffer in a hook to match that of the term face, just like the OP did 10 years back, lest I get this.令我困惑的是,我仍然必须更改钩子中 ansi-term 缓冲区的背景以匹配term face 的背景,就像 10 年前 OP 所做的那样,以免我得到这个。 Lose, lose!输,输!

在此处输入图片说明

Oh, and there is Emacs.SE now, a much better targeted place for Emacs-related questions.哦,现在有了Emacs.SE ,这是一个更好的针对 Emacs 相关问题的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM