aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS4
-rw-r--r--src/emacs.c70
2 files changed, 34 insertions, 40 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 11ef31b2c8b..764eda56a1a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -110,6 +110,10 @@ Formerly it made an exception for integer components of SOA records,
110because SOA serial numbers can exceed fixnum ranges on 32-bit platforms. 110because SOA serial numbers can exceed fixnum ranges on 32-bit platforms.
111Emacs now supports bignums so this old glitch is no longer needed. 111Emacs now supports bignums so this old glitch is no longer needed.
112 112
113** The Lisp variables 'previous-system-messages-locale' and
114'previous-system-time-locale' have been removed, as they were created
115by mistake and were not useful to Lisp code.
116
113 117
114* Lisp Changes in Emacs 28.1 118* Lisp Changes in Emacs 28.1
115 119
diff --git a/src/emacs.c b/src/emacs.c
index c5a760d29f6..4b5d00a0e80 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -930,7 +930,6 @@ main (int argc, char **argv)
930 for pointers. */ 930 for pointers. */
931 void *stack_bottom_variable; 931 void *stack_bottom_variable;
932 932
933 bool do_initial_setlocale;
934 bool no_loadup = false; 933 bool no_loadup = false;
935 char *junk = 0; 934 char *junk = 0;
936 char *dname_arg = 0; 935 char *dname_arg = 0;
@@ -1235,19 +1234,17 @@ main (int argc, char **argv)
1235 set_binary_mode (STDOUT_FILENO, O_BINARY); 1234 set_binary_mode (STDOUT_FILENO, O_BINARY);
1236#endif /* MSDOS */ 1235#endif /* MSDOS */
1237 1236
1238 /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case. 1237 /* Set locale, so that initial error messages are localized properly.
1239 The build procedure uses this while dumping, to ensure that the 1238 However, skip this if LC_ALL is "C", as it's not needed in that case.
1240 dumped Emacs does not have its system locale tables initialized, 1239 Skipping helps if dumping with unexec, to ensure that the dumped
1241 as that might cause screwups when the dumped Emacs starts up. */ 1240 Emacs does not have its system locale tables initialized, as that
1242 { 1241 might cause screwups when the dumped Emacs starts up. */
1243 char *lc_all = getenv ("LC_ALL"); 1242 char *lc_all = getenv ("LC_ALL");
1244 do_initial_setlocale = ! lc_all || strcmp (lc_all, "C"); 1243 if (! (lc_all && strcmp (lc_all, "C") == 0))
1245 } 1244 {
1246 1245 setlocale (LC_ALL, "");
1247 /* Set locale now, so that initial error messages are localized properly. 1246 fixup_locale ();
1248 fixup_locale must wait until later, since it builds strings. */ 1247 }
1249 if (do_initial_setlocale)
1250 setlocale (LC_ALL, "");
1251 text_quoting_flag = using_utf8 (); 1248 text_quoting_flag = using_utf8 ();
1252 1249
1253 inhibit_window_system = 0; 1250 inhibit_window_system = 0;
@@ -1576,14 +1573,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1576 init_alloc (); 1573 init_alloc ();
1577 init_bignum (); 1574 init_bignum ();
1578 init_threads (); 1575 init_threads ();
1579
1580 if (do_initial_setlocale)
1581 {
1582 fixup_locale ();
1583 Vsystem_messages_locale = Vprevious_system_messages_locale;
1584 Vsystem_time_locale = Vprevious_system_time_locale;
1585 }
1586
1587 init_eval (); 1576 init_eval ();
1588 init_atimer (); 1577 init_atimer ();
1589 running_asynch_code = 0; 1578 running_asynch_code = 0;
@@ -2617,25 +2606,25 @@ synchronize_locale (int category, Lisp_Object *plocale, Lisp_Object desired_loca
2617 if (! EQ (*plocale, desired_locale)) 2606 if (! EQ (*plocale, desired_locale))
2618 { 2607 {
2619 *plocale = desired_locale; 2608 *plocale = desired_locale;
2620#ifdef WINDOWSNT 2609 char const *locale_string
2610 = STRINGP (desired_locale) ? SSDATA (desired_locale) : "";
2611# ifdef WINDOWSNT
2621 /* Changing categories like LC_TIME usually requires specifying 2612 /* Changing categories like LC_TIME usually requires specifying
2622 an encoding suitable for the new locale, but MS-Windows's 2613 an encoding suitable for the new locale, but MS-Windows's
2623 'setlocale' will only switch the encoding when LC_ALL is 2614 'setlocale' will only switch the encoding when LC_ALL is
2624 specified. So we ignore CATEGORY, use LC_ALL instead, and 2615 specified. So we ignore CATEGORY, use LC_ALL instead, and
2625 then restore LC_NUMERIC to "C", so reading and printing 2616 then restore LC_NUMERIC to "C", so reading and printing
2626 numbers is unaffected. */ 2617 numbers is unaffected. */
2627 setlocale (LC_ALL, (STRINGP (desired_locale) 2618 setlocale (LC_ALL, locale_string);
2628 ? SSDATA (desired_locale)
2629 : ""));
2630 fixup_locale (); 2619 fixup_locale ();
2631#else /* !WINDOWSNT */ 2620# else /* !WINDOWSNT */
2632 setlocale (category, (STRINGP (desired_locale) 2621 setlocale (category, locale_string);
2633 ? SSDATA (desired_locale) 2622# endif /* !WINDOWSNT */
2634 : ""));
2635#endif /* !WINDOWSNT */
2636 } 2623 }
2637} 2624}
2638 2625
2626static Lisp_Object Vprevious_system_time_locale;
2627
2639/* Set system time locale to match Vsystem_time_locale, if possible. */ 2628/* Set system time locale to match Vsystem_time_locale, if possible. */
2640void 2629void
2641synchronize_system_time_locale (void) 2630synchronize_system_time_locale (void)
@@ -2644,15 +2633,19 @@ synchronize_system_time_locale (void)
2644 Vsystem_time_locale); 2633 Vsystem_time_locale);
2645} 2634}
2646 2635
2636# ifdef LC_MESSAGES
2637static Lisp_Object Vprevious_system_messages_locale;
2638# endif
2639
2647/* Set system messages locale to match Vsystem_messages_locale, if 2640/* Set system messages locale to match Vsystem_messages_locale, if
2648 possible. */ 2641 possible. */
2649void 2642void
2650synchronize_system_messages_locale (void) 2643synchronize_system_messages_locale (void)
2651{ 2644{
2652#ifdef LC_MESSAGES 2645# ifdef LC_MESSAGES
2653 synchronize_locale (LC_MESSAGES, &Vprevious_system_messages_locale, 2646 synchronize_locale (LC_MESSAGES, &Vprevious_system_messages_locale,
2654 Vsystem_messages_locale); 2647 Vsystem_messages_locale);
2655#endif 2648# endif
2656} 2649}
2657#endif /* HAVE_SETLOCALE */ 2650#endif /* HAVE_SETLOCALE */
2658 2651
@@ -2974,19 +2967,16 @@ build directory. */);
2974 DEFVAR_LISP ("system-messages-locale", Vsystem_messages_locale, 2967 DEFVAR_LISP ("system-messages-locale", Vsystem_messages_locale,
2975 doc: /* System locale for messages. */); 2968 doc: /* System locale for messages. */);
2976 Vsystem_messages_locale = Qnil; 2969 Vsystem_messages_locale = Qnil;
2977 2970#ifdef LC_MESSAGES
2978 DEFVAR_LISP ("previous-system-messages-locale",
2979 Vprevious_system_messages_locale,
2980 doc: /* Most recently used system locale for messages. */);
2981 Vprevious_system_messages_locale = Qnil; 2971 Vprevious_system_messages_locale = Qnil;
2972 staticpro (&Vprevious_system_messages_locale);
2973#endif
2982 2974
2983 DEFVAR_LISP ("system-time-locale", Vsystem_time_locale, 2975 DEFVAR_LISP ("system-time-locale", Vsystem_time_locale,
2984 doc: /* System locale for time. */); 2976 doc: /* System locale for time. */);
2985 Vsystem_time_locale = Qnil; 2977 Vsystem_time_locale = Qnil;
2986
2987 DEFVAR_LISP ("previous-system-time-locale", Vprevious_system_time_locale,
2988 doc: /* Most recently used system locale for time. */);
2989 Vprevious_system_time_locale = Qnil; 2978 Vprevious_system_time_locale = Qnil;
2979 staticpro (&Vprevious_system_time_locale);
2990 2980
2991 DEFVAR_LISP ("before-init-time", Vbefore_init_time, 2981 DEFVAR_LISP ("before-init-time", Vbefore_init_time,
2992 doc: /* Value of `current-time' before Emacs begins initialization. */); 2982 doc: /* Value of `current-time' before Emacs begins initialization. */);