I have an issue with my emacs. Sometimes, when I save and quit a file, emacs adds some characters at the beginning of my files like : B1;2802;0c

EDIT : (answer to Drew)

1 and 2 : I don't know, I can't test, characters appears randomly.

3 : My Emacs version is the 24.3.1. I don't use it in graphic, I run emacs with -nw

4 : My actions are : save with ctr + x + s, and then quit with ctr + x + c. Then, if I emacs -nw my files, sometimes random characters are at the beginning. I'm working on many types of files and it happens at all (.c, .cpp, .S). No special characters and the lengths of the files haven't something special.

  • 2
    As always: (1) Does this happen if you don't use your init file (emacs -Q)? (2) If not, bisect your init file recursively until you find the cause. (3) For something like this, always specify your Emacs version and platform, and whether you are using terminal mode or a graphical display. (4) Specify what your actions are. E.g., what does "save and quit a file" mean concretely? And try to find out more about "sometimes": when? after doing what? anything special about the particular files (e.g. special characters, length)? – Drew Mar 18 '14 at 23:54
  • I edited my question – Jérémy Pouyet Mar 19 '14 at 16:53
  • 1
    I'm afraid that for someone to help you will need to look into #1 and #2. Try using Emacs without your init file for a while. If you no longer see the problem, then take a guess that the problem comes from your init file. In that case, try using just half of your init file for a while. And so on. You will need to debug this, to provide more info. Otherwise, I doubt that anyone will be able to help you. You can also try sending a mail to help-gnu-emacs@gnu.org, but I expect that you will get a similar reply there. – Drew Apr 3 '14 at 0:01

I had almost this exact problem (well, it pasted >1;2802;0c, which differs by a few characters). A couple things: at first I thought it was adding to the file on write or close as you found, but on closer examination it was inserting the characters in the buffer on open, at the point where my mark was when I last opened the file (without saving it, so if I hit undo immediately on opening the file, the characters were deleted).

Anyway, I followed Drew's advice and started commenting bits of my init.el, and the culprit turned out to be that I'd used a global set key to remap M-[ to window-changing functions. I don't know what was conflicting with that key, but apparently something.

Also of note, and probably related, this solved a different long-standing issue I'd had where middle-mouse-button pasting added extra characters (in this case ~200 and ~201 I think) on either side of the pasted text.

As with with OP (and in common with other similar issues on other threads), this is all using emacs -nw in a terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.