简体   繁体   English

退出emacs后如何还原xterm颜色

[英]How to restore xterm colors after quitting emacs

When I use emacs from a terminal (xterm-color; a putty ssh session in this case) the font color used by emacs is different from the one I use in the shell. 当我从终端(xterm-color;本例中为腻子ssh会话)使用emacs时,emacs使用的字体颜色与外壳中使用的字体颜色不同。 Which is fine. 没关系 BUT, after I quit emacs (or suspend it for that matter) the colors are not restored. 但是,我退出emacs(或为此暂停)后,颜色将无法恢复。

Is there anything I can do to restore my term colors when returning to the shell after my emacs session? 在emacs会话后返回到shell时,我能做些什么来恢复我的术语颜色?

I have aliased my ls command to add --color option, which if I run it restores my colors if the listing shows any files with "non-default" color, but that is a rather ugly way to get my colors back. 我已经为ls命令添加了--color选项,这是我别名的ls命令,如果清单显示任何带有“非默认”颜色的文件,如果运行该命令,它将恢复我的颜色,但这是使我的颜色恢复的相当难看的方法。

Use a wrapper script for emacs that runs "tput reset" after emacs exits: 使用emacs退出后运行“ tput reset”的emacs的包装器脚本:

#!/bin/sh
emacs &
pid=$!
wait $pid
trap "kill $pid 2>/dev/null; tput reset" TERM INT EXIT

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

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