tags:

views:

78

answers:

3

Update: This only occurs when I access the particular server from a Windows machine

With emacs tramp (plink) I'm logging on to 2 different servers, and am experiencing a problem in one of them with find-file.

If I do tab completion in a directory, all file names have ^M appended to them, e.g.:

Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
-name^M       ../^M
./^M         .bash_history^M
.git/^M       .gitconfig^M
.gitignore^M  .lesshst^M
.ssh/^M       .subversion/^M

and when I tab-complete the file name, it completes with the ^M suffix, which is the filename of a nonexistent file:

/plink:[email protected]:/home/me/.gitignore^M

Anyone experience a similar problem? ^M is ungoogleable!

A: 

^M is Enter.

It could has to do with DOS vs. Unix line break.

DOS: (13, 10)
Unix: (10)

So when you want to write lines using DOS style, a Unix style renderer will say:

your like(char13)
another line

Check your terminal and stuff like that...

And... if you are writing a batch file for Unix in DOS happens the same. You have to convert it using dos2unix filename to remove the extra 13's in your file.

helios
A: 

^M really is the carriage return part of a carriage return/line feed (hex 0x0d, oct 015). You probably need to configure your server to use linefeeds as line endings. There might be a way to fix this in emacs, but I don't know offhand.

In a way, it's MS Windows (carriage return/line feed) vs. Linux (line feed) issue. However, it's not really that simple and boths types of line endings are there for a historically good reason.

I'm not sure it's to do with line endings, as it is not a problem with the contents of the file, but with the listing of file names.
EoghanM
A: 

As mentioned elsewhere, ^M is the CR character, which makes up the first half of a CR LF pair used as a line terminator in DOS. Unix/Linux just uses the LF, so the ^M is displayed as an extra character.

When I see this in vim, I remove it by searching for ^M and replacing it with nothing. To specify ^M I press ctrl-V then M

I'm sure emacs has some way to do the same thing.

pavium
Emacs does, I think it's C-q C-m.
High Performance Mark
No can do: I'd have to switch to the find-file buffer from the minibuffer. Also the find-file buffer is read only.
EoghanM