all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Paul W. Rankin" <hello@paulwrankin.com>, Glenn Morris <rgm@gnu.org>
Cc: 39248@debbugs.gnu.org, Alan Third <alan@idiocy.org>
Subject: bug#39248: format-time-string ignores user's preferred locale
Date: Thu, 23 Jan 2020 23:35:20 -0800	[thread overview]
Message-ID: <e07faf68-93b1-ff1a-4474-233216ec8151@cs.ucla.edu> (raw)
In-Reply-To: <DF469EB2-9110-4982-9165-A3A529D6CC71@paulwrankin.com>

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

On 1/23/20 7:17 PM, Paul W. Rankin wrote:
> The relationship doesn't appear as the same as on GNU/Linux.

It's similar, in that one can launch apps in various ways (e.g., via Gnome) 
without involving shell environment variables.

Looking into this a bit more, I see that Alan Third wrote a fix for this problem 
(which is apparently quite a zoo in macOS, as Apple keeps changing how to set 
environment variables!) into Emacs in master commit 
2016-02-11T02:26:50Z!alan@idiocy.org. However, Emacs currently sets the LANG 
environment variable in ns_init_locale *after* Emacs uses LANG to set the 
LC_TIME locale, which is not what is wanted here. So, please try the attached 
patch to master. You'll need to grab the latest master as I recently installed a 
locale cleanup patch while looking into this mess.

If this patch doesn't work for you, perhaps you can write a small variant of it 
that does work.

[-- Attachment #2: 0001-Propagate-NSLocale-into-Emacs-better.patch --]
[-- Type: text/x-patch, Size: 1405 bytes --]

From 82821adea730dab5a42d24e49675ade1c2f5c1f3 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 23 Jan 2020 23:16:47 -0800
Subject: [PATCH] Propagate NSLocale into Emacs better

* src/emacs.c (main): Call ns_init_locale before using the
environment variable that ns_init_locale sets up (Bug#39248).
---
 src/emacs.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index 4b5d00a0e8..c170333e60 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1242,6 +1242,9 @@ main (int argc, char **argv)
   char *lc_all = getenv ("LC_ALL");
   if (! (lc_all && strcmp (lc_all, "C") == 0))
     {
+      #ifdef HAVE_NS
+        ns_init_locale ();
+      #endif
       setlocale (LC_ALL, "");
       fixup_locale ();
     }
@@ -1610,10 +1613,6 @@ main (int argc, char **argv)
 
 #ifdef HAVE_NS
   ns_pool = ns_alloc_autorelease_pool ();
-#ifdef NS_IMPL_GNUSTEP
-  /* GNUstep stupidly resets our locale settings after we made them.  */
-  fixup_locale ();
-#endif
 
   if (!noninteractive)
     {
@@ -1724,11 +1723,6 @@ main (int argc, char **argv)
   globals_of_gfilenotify ();
 #endif
 
-#ifdef HAVE_NS
-  /* Initialize the locale from user defaults.  */
-  ns_init_locale ();
-#endif
-
   /* Initialize and GC-protect Vinitial_environment and
      Vprocess_environment before set_initial_environment fills them
      in.  */
-- 
2.24.1


  reply	other threads:[~2020-01-24  7:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23  3:48 bug#39248: format-time-string ignores user's preferred locale Paul W. Rankin
2020-01-23  5:56 ` Eli Zaretskii
2020-01-23  6:44   ` Paul W. Rankin
2020-01-23 14:19     ` Eli Zaretskii
2020-01-23  8:38 ` Paul Eggert
2020-01-23 13:12   ` Paul W. Rankin
2020-01-23 18:05     ` Eli Zaretskii
2020-01-23 22:04       ` Glenn Morris
2020-01-24  3:17         ` Paul W. Rankin
2020-01-24  7:35           ` Paul Eggert [this message]
2020-01-25  9:36             ` Paul W. Rankin
2020-01-25 11:18             ` Alan Third
2020-01-25 11:42               ` Paul W. Rankin
2020-01-25 12:03                 ` Alan Third
2020-01-26  8:35               ` Paul Eggert
2020-01-26 10:26                 ` Alan Third

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

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

  git send-email \
    --in-reply-to=e07faf68-93b1-ff1a-4474-233216ec8151@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=39248@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=hello@paulwrankin.com \
    --cc=rgm@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.