Whenever I open a file encoded with dos end lines, Emacs decides it's encoded in undecided_linux and displays ^M after each line.

I checked, those files all have matching newline characters (no odd ^J without a preceding ^M).

I have set the following:

(setq-default buffer-file-coding-system 'utf-8-dos)
(prefer-coding-system 'utf-8-dos)

When I test buffer-file-coding-system in a file, I get:

buffer-file-coding-system is a variable defined in ‘C source code’.
Its value is ‘undecided-unix’
Local in buffer foo; global value is utf-8-dos

  Automatically becomes permanently buffer-local when set.

I'm using:

  • GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30
  • Prelude (commit ID 63c697c2f4ca3cc8b8329f70a3b6ed474db312d5, Jan 1 2019, with some minor personal tweaks of mine).

This started recently, I'm pretty sure I didn't change anything in configuration or versions before it started happening.

Did anyone have such problems? Or should I just update Emacs and Prelude in hopes it's fixed?

  • What happens when you start with Emacs -Q? And then find-file? Also I assume windows OS? Also what's on left of modeline? – Rusi Jan 29 at 13:57
  • @Rusi, I checked yesterday before seeing your comment: * Starting Emacs -Q did fix this behavior * Stashing (in git) all my changes in .emacs.d also fixed everything, so I guess I did break my configuration myself somehow. It's crazy, because I was shure that all uncommited changes to .emacs.d were specifically added to fix this problem. – em3 Jan 30 at 10:37
  • OK, I'm pretty sure I'm going crazy. I reapplied stashed changes to emacs.d... and the problem did not reappear. – em3 Jan 30 at 10:48
  • 😊😀😁 good to know – Rusi Jan 30 at 10:59
  • This aspect particularly is very tied in to system settings — locale stuff in Linux not sure of windows equivalent. IOW it's best to tweak these things outside of emacs at least on linux – Rusi Jan 30 at 11:00

Your Answer

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

Browse other questions tagged or ask your own question.