Manuel Mussini wrote:
> Hi,
> I'm a dual-boot user (Scientific Linux and Windows XP) because for work
> reasons I need both OSs!
> I think that you can solve my problem!
> How can I tell to emacs (21.3.1 for Windows) to save files in Unix mode? I
> mean: if I write a bash script under Windows and then I switch to Linux, the
> script doesn't work because of the different EOF for the two OS!
> On the web I found a solution from a guy who said to add:
> 
> (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m)
> 
> at the end of the .emacs! I tried it but it doesn't work!
> The only working solutions I've found are:
>    - Windows-solution: use a hex editor to remove the ^Ms
>    - Unix-solution: use dos2unix
> 
> But I think that there should be a smarter and quick solution to do that!

Emacs should try to figure out what to do with existing files:

http://www.gnu.org/software/emacs/manual/html_node/Text-and-Binary.html
http://www.gnu.org/software/emacs/manual/html_node/Recognize-Coding.html#Recognize-Coding

You can tell it never to try CR+LF on certain filesystems:
(add-untranslated-filesystem "Z:")

It also may need some help with newly-created files:

(setq default-buffer-file-coding-system iso-8859-1-unix)