Emacs adds something on the top of every file

456 Views Asked by At

When I open files with emacs it adds 12;rgb:1c1c/1c1c/1c1c on the top. How can I prevent this?

I have installed emacs on a clean reinstalled debian system.

Emacs: GNU Emacs 24.4.1

Terminal Emulator: MobaXterm Personal Edition v7.7

System (local): Windows 7 Ultimate

System (remote): Debian 8.0 "jessie" stable

4

There are 4 best solutions below

0
On BEST ANSWER

!! SOLVED IN MOBAXTERM VERSION 8.2 !!

0
On

VT220 works fine; Edit Session / Terminal Settings / Type: vt220

6
On

Looks like your terminal settings are out of sync. The settings of your terminal need to agree with the termcap/terminfo settings on the server. Try to set the TERM variable in the shell on the server to a value which better matches the terminal emulation capabilities of your terminal (common values are xterm, xterm-color, vt520, and vt102) or correspondingly change the settings of the terminal to match the current TERM value. (If the terminal is buggy, you may need some trial and error to find a mode which works well for you.)

2
On

As noted, "MobaXterm" is not "xterm". According to its webpage it is

Based on PuTTY/MinTTY with antialiased fonts and macro support

Lacking a detailed change history, and the problem reported by the OP, it seems that MobaXterm is based on PuTTY from a while back, and does not implement all of the control sequences which PuTTY does, much less those of xterm.

The particular sequence which is not recognized (referring to XTerm Control Sequences) may be this:

OSC Ps ; Pt ST
OSC Ps ; Pt BEL
...
    Ps = 1 2  -> Change text cursor color to Pt.

That is part of a group of controls predating ANSI color support in xterm, referred to as dynamic colors.

Based on comments in other places, it seems that the problem could lie within the OP's Emacs configuration, by using scripts which do an ad hoc test of TERM to decide if it can do colors, rather than inspecting the terminal capabilities. See Terminal emacs colors only work with TERM=xterm-256color where someone worked around this problem by modifying their init.el to add special cases for rxvt and xterm.

Emacs of course is capable of doing colors in different terminals. See emacs colors based on $TERM environment variable for comments. And TERM=xterm on Debian has provided color for quite a while. So in a typical configuration, color should "just work".

However, there are different ways to configure Emacs. Attempting to reuse some 256-color script can fall into the hole dug by developers who assume that every terminal is just like the one in front of them. See the Emacs wiki page X Term Colors for an example.