On Sun, Nov 14, 2021 at 12:56:14PM +0200, Eli Zaretskii wrote: > > From: Philipp > > Date: Sun, 14 Nov 2021 11:41:38 +0100 > > Cc: Lars Ingebrigtsen , > > tor.a.s.kringeland@ntnu.no, > > 51832@debbugs.gnu.org, > > alan@idiocy.org > > > > > I asked once why we push LANG into the environment, instead of calling > > > setlocale, which would only affect Emacs. I don't think I saw an > > > answer to that question, or did I miss it? > > > > > > > AIUI the intention is that this should affect subprocesses started from Emacs. At least that's how I interpret the comment > > > > /* macOS doesn't set any environment variables for the locale when run > > from the GUI. Get the locale from the OS and set LANG. */ > > Why is that needed? > > And if it is needed, how come we are setting LANG to an invalid locale > and the system somehow sets it to the correct locale? macOS itself doesn't set any locale related environment variables, any application that is running UNIX style commands is expected to set them itself. The UNIX commands don't themselves pick up the locale from the system, they rely on the environment variables. In other words, as with anything UNIXy on macOS, it's a badly thought out mess. It seems suspicious to me that we've had this code since Emacs 26, but only in the last few weeks we've had two complaints about it. Having dug out my Mac I can't convince it to show any of the errors that have been reported, so I suspect either the latest version of macOS has made the locale handling much more strict or has removed a lot of locales. I've attached a patch that may do something towards preventing this problem but ultimately this is a convenience to give a best guess at choosing the correct dictionary, date format, etc. If we can't easily fix it then we can drop it and tell people to set it in their init.el themselves. -- Alan Third