|
Editing remote files using SSH: line endings |
|
Facts -
Editor: emacs
|
|
Thursday, 31 December 2009 08:16 |
|
This article contains information on creating remote files using plink (Putty, SSH) called from the emacs tramp package, on Windows 7 or Windows XP, emacs version 23.1.1
Emacs can be used to remotely edit files over SSH, for instance on unix servers. Many pages on the web explain how to get this working using the emacs tramp package so I won't describe it here. Nevertheless I did have troubles to get it working, see this related article.
When I create a remote file on a unix system it creates the file in DOS mode, with different characters for the line endings. If this file contains a shell script then it won't run on my linux virtual server. To save the file with unix line endings first invoke the emacs command set-buffer-file-coding-system and use unix as the coding system. Then save your buffer. If you are editing files on a remote mac then you can use mac as the coding system. If you running emacs on a unix system and editing files on a windows system over ssh then use dos as the coding system.
When I edit an existing remote file on a unix system I don't have to set the coding system: emacs automatically recognizes it.
|