Subject: Re: bug#24741: 25.1.50; Buffer encoding corrupted up by 'make' in shell-mode

From: Eli Zaretskii <[email-masked]>
Date: Sat, 22 Oct 2016 10:17:48 +0300

> From: Simon Peyton Jones <[email-masked]>
> CC: "[email-masked]" <[email-masked]>, Simon Peyton Jones
> 	<[email-masked]>
> Date: Fri, 21 Oct 2016 21:20:34 +0000
> 
> If you want me to try emacs -Q, just let me know how to do that and what info to collect.  I've never done that before.

Start Emacs with "emacs -Q", then try reproducing the problem by doing
whatever you do when the problem normally happens.

If "emacs -Q" lacks some optional features and custom settings of
certain variables, load those features and customize those variables
as part of the recipe (i.e. record everything you need to do starting
from "emacs -Q" until you are able to run the commands that produce
the problematic output).

Then post here the full recipe for reproducing the problem, including
everything you have recorded on the way.

> Customisations. In my .emacs I have the following, which John Wiegley gave to me in the first place
> 
> (setq-default locale-coding-system 'utf-8-unix)
> (setq-default buffer-file-coding-system 'utf-8-unix)
> (set-default-coding-systems 'utf-8-unix)
> (set-terminal-coding-system 'utf-8-unix)
> (set-keyboard-coding-system 'utf-8-unix)
> (set-selection-coding-system 'utf-8-unix)
> (prefer-coding-system 'utf-8-unix)
> 
> (defun utf8-shell ()
>   (interactive)
>   (set-default-coding-systems 'utf-8-unix)
>   (shell))

This is already dead wrong on Windows, especially setting the default
encodings to UTF-8.  It cannot possibly work well on Windows.  And you
shouldn't need this.

What happens if you remove these and try again -- does the problem
still appear?

Where did you get your Bash, your make.exe, and your Python?  If they
are from the MSYS2 project, the only customization of coding-systems
you may need is of process-coding-system-alist.  If you do that, make
sure the encoding is still your system codepage, and only the decoding
part is UTF-8.  That's because the encoding is used to encode the
command-line arguments, and you certainly don't want them to be
encoded in UTF-8 on Windows, because this is unsupported.