Subject: bug#65908: 29.1.50; Emacs 29 regresses on macOS

From: Gerd Möllmann <[email-masked]>
Date: Thu, 05 Oct 2023 07:55:55 +0200

Alan Third <[email-masked]> writes:

>> which is the output of 'locale' in a terminal, translated to Elisp.
>> With these settings, the slowdown is gone, without changing the code.
>
> So is Emacs run in the terminal with a LANG of something like
> en_GB.UTF-8 slower too? Because iirc my mac's terminal doesn't default
> to 'C' and I don't see anything GUI specific in the test code...
>
> FWIW I don't see any meaningful difference using different locale
> settings on my Debian box, which makes me wonder if there is some
> low-level darwin code that reads the locale from the environment. Any
> idea if it's loading the files or stepping through the defuns that's
> slower, or both?
>
> Long story short: I have no idea what's going on here.

Me neither.  I tried to find something definitive about locales+bundles
Apple's docs, and on the Internet in general, but failed miserably.
What a mess.

Anyway, something is odd here, I think.

When I start 058c012f73d4abe014ace44b46c23babd48aebbc by double-clicking
Emacs.app, then M-x shell, I get

$ locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

That can't be right, or is it?

The same, one commit before that:

$ locale
LANG="en_DE.UTF-8"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

At least LANG looks correct to me (I'm using an English UI, in DE.).
The LC_* are odd, though.

As an aside - vscode sets all of these vars to "en_US.UTF-8" which is
looks wrong, and the Zed editor does the same, except for LANG which it
set to "".

I must admit that I can't come to a conclusion here.  Maybe the right
thing would be LANG="en_DE.UTF-8" plus setting LC_ALL=$LANG like vscode?