如何保持emacs颜色从普通终端到gnu屏幕 [英] How to preserve emacs colors from regular terminal to gnu screen

查看:182
本文介绍了如何保持emacs颜色从普通终端到gnu屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OSX雪豹,作为记录。



当我从终端直接使用emacs时,我有一个颜色集(例如c / c ++)我很高兴---绿色的黑色,红色的评论,彩色的关键字...等等。一些这是设置在我的终端喜好,一些是在我的〜/ .emacs文件下面)。当我从屏幕运行emacs时,基本颜色方案是相同的(黑色的绿色),但着色是不同的(例如注释字符是红色,但不是整个评论) - 真的很讨厌。

$



在我的'.emacs'文件(这停止工作在gnu屏幕emacs):

/ p>

 (global-font-lock-mode t)
(custom-set-faces
' -lock-comment-face
(((class color)(background light))
:foregroundtomato)
)))

  

shell - $ SHELL#颜色仍然不工作没有这
#term xterm-256color#使用这不会修复颜色(建议在一些论坛)

altscreen on
startup_message off

我认为我的.screenrc文件中的命令'shell - $ SHELL'命令提示符在屏幕中与默认值相同---它确实使我的命令行说'computername:/ DIR / username $'而不是只是'bash-3.2 $'



========================================= ========================



解决方案:感谢 Greg E。



我需要在屏幕中设置我的终端模拟器以匹配我的正常shell。为此,我添加了

  export TERM ='xterm-color'

到〜/ .bash_profile



出于某种原因,'term xterm-color' 〜/ .screenrc'文件没有工作。

解决方案

我的怀疑是,虽然你的终端可能编译支持超过标准的16种颜色,你的特定版本的GNU屏幕可能不会。我对OSX不是很熟悉,但是在Linux上我会检查 tput colors 的输出在普通终端和一个运行屏幕之间是否不同(我期望有如果 tput 不可用,则为某个OSX等效项)。如果是,您可能需要安装(或手动编译)包含支持其他颜色的不同版本的屏幕(通常,256是最大值,但88也是常见的,而16是默认最小值)。



编辑:最终,正确的解决方案证明是手动设置 $ TERM 环境变量(见下面的注释)。 p>

I'm using OSX snow leopard, for the record.

When I use emacs straight from terminal, I have a color set (e.g. for c/c++) that I'm very happy with---green on black, red comments, colored key words... etc etc. Some of this is set in my 'terminal preferences', and some is in my ~/.emacs file (see below). When I run emacs from screen, the basic color-scheme is the same (green on black), but the coloring is different (e.g. comment characters are red, but not the entire comments) -- and really annoying.

Any help would be appreciated!

In my '.emacs' file (this stops working in gnu-screen emacs):

(global-font-lock-mode t)
(custom-set-faces
 '(font-lock-comment-face
   ((((class color) (background light))
     :foreground "tomato")
    )))

In my '.screenrc' file:

shell -$SHELL            # colors still don't work without this
#term xterm-256color    # using this doesn't fix the colors (suggested on some forums)

altscreen on
startup_message off

I thought that the command 'shell -$SHELL' in my .screenrc file made the command prompt in screen the same as the default --- it does make my command line say 'computername:/DIR/ username$' instead of just 'bash-3.2$'

=================================================================

Solution: Thanks to Greg E.

I needed to set my terminal emulator in screen to match that of my normal shell. To do this, I added

export TERM='xterm-color'

to ~/.bash_profile

For some reason, 'term xterm-color' in the '~/.screenrc' file didn't work.

解决方案

My suspicion is that, while your terminal may be compiled with support for more than the standard 16 colors, your particular version of GNU screen may not be. I'm not very familiar with OSX, but on Linux I'd check whether the output of tput colors differs between a plain terminal and one running screen (I'd expect there to be some OSX equivalent if tput is not available). If it does, you may need to install (or manually compile) a different build of screen that includes support for additional colors (normally, 256 is the maximum, but 88 is also common, while 16 is the default minimum).

Edit: Ultimately, the correct solution proved to be manually setting the $TERM environment variable (see comments below).

这篇关于如何保持emacs颜色从普通终端到gnu屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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