GNU bug report logs - #65908
29.1.50; Emacs 29 regresses on macOS

Previous Next

Package: emacs;

Reported by: Zhang Haijun <ccsmile2008 <at> outlook.com>

Date: Wed, 13 Sep 2023 06:48:02 UTC

Severity: normal

Found in version 29.1.50

Fixed in version 29.2

Done: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: alan <at> idiocy.org, gregory <at> heytings.org, 65908 <at> debbugs.gnu.org, stefankangas <at> gmail.com, ccsmile2008 <at> outlook.com
Subject: bug#65908: 29.1.50; Emacs 29 regresses on macOS
Date: Thu, 05 Oct 2023 10:52:21 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
>> Cc: Stefan Kangas <stefankangas <at> gmail.com>,  Gregory Heytings
>>  <gregory <at> heytings.org>,  65908 <at> debbugs.gnu.org,  Eli Zaretskii
>>  <eliz <at> gnu.org>,  ccsmile2008 <at> outlook.com
>> Date: Thu, 05 Oct 2023 07:55:55 +0200
>>
>> 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.
>
> Emacs forces LC_ALL= and LC_NUMERIC=C, to properly localize the
> initial error messages and format numbers as in the "C" locale, see
> 'main' (which also has an NS-specific code).

Thanks for the hint, Eli.

I've meanwhile found out something.  Not yet sure what to make of this,
but anyway:

1. In ns_init_locale, [locale localeIdentifier] returns "en_DE" on my
system, which is, I think, a consequence of my system settings, as I
mentioned (English UI in Germany).

2. man setlocale(3) says this

     An argument of "" will
     determine the name of the new locale taking into account the environment
     variables LANG and LC_*.

So, the setlocale (LC_ALL, "") in main should initialize LC_* according
to LANG, if set.  (Another question might be if that is what was
intended here, when I read the comment above that code, but be that as
it may.)

And another thing - any setlocale in ns_init_locale is moot because it
will be undone in main.

4. When I setenv LANG="en_DE.UTF-8" in ns_init_locale, the setlocale
(LC_ALL, "") returns NULL, indicating that LANG is invalid.  And, indeed

  $ locale -a | grep de
  de_CH
  de_DE.UTF-8
  de_AT.ISO8859-1
  de_AT.UTF-8
  de_AT.ISO8859-15
  de_DE.ISO8859-15
  de_CH.UTF-8
  de_CH.ISO8859-15
  de_DE.ISO8859-1
  de_CH.ISO8859-1
  de_AT
  de_DE

  There is no en_DE...

5. When I don't use localeIndentifier, but "en_US.UTF-8", for instance,
   the setlocale (LC_ALL, "") in main works like expected, and in a shell
   buffer:

  $ ~/emacs/master/src/ > locale
  LANG="en_US.UTF-8"
  LC_COLLATE="en_US.UTF-8"
  LC_CTYPE="UTF-8"
  LC_MESSAGES="en_US.UTF-8"
  LC_MONETARY="en_US.UTF-8"
  LC_NUMERIC="en_US.UTF-8"
  LC_TIME="en_US.UTF-8"
  LC_ALL=

That's all not very nice :-).

Conclusion so far, for me,

- don't selocale in ns_init_locale, only setenv LANG, or set LC_CTYPE,
  maybe.
- localeIndentifier is wrong for mixed cases like "en_DE".





This bug report was last modified 1 year and 226 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.