emacs显示错乱, 搞不明白原因

估计是TERM环境变量设置的问题.

emacs使用的ansi控制码和终端设置的不一样.

$echo $TERM xterm-256color

这个怎么看是不是一样的呢? 怎么设置呢?

  1. 用 GUi 试试,问题还能复现吗
  2. 确认是Emacs后,二分法排查一下配置
  3. 如果配置在版本控制里,而且是最近突然出现的问题,可以 git bisect

试试把TERM设置成其它类型例如:export TERM=screen

这是远程登录服务器出现的问题 不能使用gui的吧 本地使用没问题的 估计就是和服务器的环境有关

还是有问题~

有谁遇到过吗

我也遇到同样的问题,只找到ArchLinux的wiki里的一个方法

> ### Emacs-nox output gets messy
> 
> When working in a terminal, the color, indentation, or anything related to the output might become crazy. This is (probably?) because Emacs was sent a special character at some point which may conflict with the current terminal. If this happens you can do  `M-x redraw-display` , which will redraw the terminal's display. If this problem happens frequently, you might want to bind the command to a key, e.g. by putting something like
> 
> (global-set-key (kbd "<f7>") 'redraw-display)
> 
> in your .emacs file.
> 
> Graphical Emacs does not suffer from this issue.

Emacs-nox output gets messy