unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: alan@idiocy.org, gregory@heytings.org, 65908@debbugs.gnu.org,
	stefankangas@gmail.com, ccsmile2008@outlook.com
Subject: bug#65908: 29.1.50; Emacs 29 regresses on macOS
Date: Thu, 05 Oct 2023 10:52:21 +0200	[thread overview]
Message-ID: <m2il7lzc1m.fsf@Pro.fritz.box> (raw)
In-Reply-To: <83o7hd4n5n.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 05 Oct 2023 09:08:04 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: Stefan Kangas <stefankangas@gmail.com>,  Gregory Heytings
>>  <gregory@heytings.org>,  65908@debbugs.gnu.org,  Eli Zaretskii
>>  <eliz@gnu.org>,  ccsmile2008@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".






  reply	other threads:[~2023-10-05  8:52 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13  6:47 bug#65908: 29.1.50; Emacs 29 regresses on macOS Zhang Haijun
2023-10-04  5:44 ` Gerd Möllmann
2023-10-04  7:38   ` Eli Zaretskii
2023-10-04  7:50     ` Gerd Möllmann
2023-10-04  8:29       ` Stefan Kangas
2023-10-04  8:32         ` Gerd Möllmann
2023-10-04  9:02         ` Gregory Heytings
2023-10-04  9:12           ` Gerd Möllmann
2023-10-04  9:12           ` Stefan Kangas
2023-10-04 10:55             ` Gerd Möllmann
2023-10-04 12:43               ` Gerd Möllmann
2023-10-04 21:16                 ` Alan Third
2023-10-05  5:41                   ` Eli Zaretskii
2023-10-05  5:55                   ` Gerd Möllmann
2023-10-05  6:08                     ` Eli Zaretskii
2023-10-05  8:52                       ` Gerd Möllmann [this message]
2023-10-05  9:48                         ` Alan Third
2023-10-05 11:12                           ` Gerd Möllmann
2023-10-05 13:18                             ` Gerd Möllmann
2023-10-05 16:11                               ` Eli Zaretskii
2023-10-05 16:33                                 ` Alan Third
2023-10-05 16:38                                   ` Gerd Möllmann
2023-10-05 17:02                                   ` Eli Zaretskii
2023-10-05 17:15                                     ` Alan Third
2023-10-05 13:51                             ` Alan Third
2023-10-05 14:01                               ` Gerd Möllmann
2023-10-05 14:09                               ` Gerd Möllmann
2023-10-05 14:58                                 ` Alan Third
2023-10-05 15:11                                   ` Gerd Möllmann
2023-10-05 16:29                                     ` Eli Zaretskii
2023-10-05 16:39                                       ` Gerd Möllmann
2023-10-05 17:06                                         ` Eli Zaretskii
2023-10-05 18:08                                           ` Stefan Kangas
2023-10-05 13:56                             ` Gerd Möllmann
2023-10-05 16:19                               ` Eli Zaretskii
2023-10-05 16:26                                 ` Alan Third
2023-10-05 16:43                                   ` Gerd Möllmann
2023-10-05 16:36                                 ` Gerd Möllmann
2023-10-05 17:04                                   ` Eli Zaretskii
2023-10-05 17:15                                     ` Gerd Möllmann
2023-10-05 18:25                                       ` Alan Third
2023-10-05 18:33                                         ` Gerd Möllmann
2023-10-05 18:46                                           ` Gerd Möllmann
2023-10-05  8:58             ` Gregory Heytings
2023-10-05  9:03               ` Gregory Heytings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2il7lzc1m.fsf@Pro.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=65908@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=ccsmile2008@outlook.com \
    --cc=eliz@gnu.org \
    --cc=gregory@heytings.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).