Garbled text in emacs over SSH?

RedShark

[H]ard|Gawd
Joined
Aug 8, 2003
Messages
1,939
Hey,

No, I don't want to switch to vim at this time :)

The problem occurs when:
- font-lock-mode is enabled
- I scroll up/down in the file, e.g. a .c file.
- I use SecureCRT 5.0, 5.5, or 6.0 on Windows Vista.

I get garbled text like this, after scrolling down and back up:

garbled.png


Other details about when this does and does not occur:
- I've only ever noticed it in Emacs, but then, that's about all I run in the terminal.
- Using another terminal works fine, but this is definitely not my preferred solution (SecureCRT supports Kerberos authentication and this is required--PuTTY, for instance, does not).
- Pressing CTRL-L in Emacs to refresh the screen causes the corruption to go away. This is clearly a terminal issue of some kind. The garbage is not in the Emacs buffer.
- If I turn off font lock mode, the syntax highlighting goes away and so does the garbled text. I can scroll up/down and not have the problem.
- The problem occurs with two different versions of Emacs and both with and without a .emacs file.

I suspect this can be fixed with clever application of stty or something, but I don't know precisely what to use. The emacs documentation suggests looking at etc/TERMS (for me, in emacs/share/emacs/22.1/etc/TERMS) but I'm not quite sure how to proceed from this since I've never had to fiddle with such arcane settings before, and I don't really want to screw it up.

Any tips/suggestions? Any tutorials on how to modify these settings, if you think that's the right direction? Thanks in advance. :)
 
In case anyone's interested, I narrowed the problem down to something related to long comments, like /* blah */. If I delete the long /* */ style comment at the top of the file in question, and then scroll around, the screen remains garbage free. Very strange. I still am not quite sure what to do about it though.
 
Would declaring the TERM variable help? If you echo $TERM before you run emacs, see what it outputs. Try switching it to vt220 or xterm or some widely supported one.
 
Thank you for your input--unfortunately that trick doesn't seem to work. :(

I tried:
- Setting the terminal emulation to vt220 in SecureCRT
- Typing "export TERM=vt220" (using Bash shell)
- Running emacs

but the problem persisted. Additionally, the coloring went away despite checking the "ANSI color" checkbox.

Also tried:
- Setting the terminal emulation to xterm in the properties for the connection I'm using in SecureCRT
- Starting a new session
- Verifying "echo $TERM" reports "xterm"
- Running emacs

but this was the same issue.

I recall in the past trying all the different terminal emulation modes in SecureCRT but the problem persisted in each.
 
Back
Top