comparison src/emacs.c @ 26590:301daf47e723

* emacs.c (fixup_locale): Don't bother to record initial locale. (synchronize_locale): If the desired locale is nil, treat it as if it were the empty string, so that we set the locale from the environment.
author Paul Eggert <eggert@twinsun.com>
date Thu, 25 Nov 1999 05:33:31 +0000
parents f6e79aed5c2e
children 8122fc2dd490
comparison
equal deleted inserted replaced
26589:929999669c16 26590:301daf47e723
1909 #if HAVE_SETLOCALE 1909 #if HAVE_SETLOCALE
1910 /* Recover from setlocale (LC_ALL, ""). */ 1910 /* Recover from setlocale (LC_ALL, ""). */
1911 void 1911 void
1912 fixup_locale () 1912 fixup_locale ()
1913 { 1913 {
1914 char *l;
1915
1916 /* The Emacs Lisp reader needs LC_NUMERIC to be "C", 1914 /* The Emacs Lisp reader needs LC_NUMERIC to be "C",
1917 so that numbers are read and printed properly for Emacs Lisp. */ 1915 so that numbers are read and printed properly for Emacs Lisp. */
1918 setlocale (LC_NUMERIC, "C"); 1916 setlocale (LC_NUMERIC, "C");
1919
1920 #ifdef LC_MESSAGES
1921 l = setlocale (LC_MESSAGES, (char *) 0);
1922 Vprevious_system_messages_locale = l ? build_string (l) : Qnil;
1923 #endif
1924 l = setlocale (LC_TIME, (char *) 0);
1925 Vprevious_system_time_locale = l ? build_string (l) : Qnil;
1926 } 1917 }
1927 1918
1919 /* Set system locale CATEGORY, with previous locale *PLOCALE, to
1920 DESIRED_LOCALE. */
1928 static void 1921 static void
1929 synchronize_locale (category, plocale, desired_locale) 1922 synchronize_locale (category, plocale, desired_locale)
1930 int category; 1923 int category;
1931 Lisp_Object *plocale; 1924 Lisp_Object *plocale;
1932 Lisp_Object desired_locale; 1925 Lisp_Object desired_locale;
1933 { 1926 {
1934 if (STRINGP (desired_locale) 1927 if (! EQ (*plocale, desired_locale))
1935 && (NILP (*plocale) || NILP (Fstring_equal (*plocale, desired_locale))) 1928 {
1936 && setlocale (category, XSTRING (desired_locale)->data)) 1929 *plocale = desired_locale;
1937 *plocale = desired_locale; 1930 setlocale (category, (STRINGP (desired_locale)
1931 ? XSTRING (desired_locale)->data
1932 : ""));
1933 }
1938 } 1934 }
1939 1935
1940 /* Set system time locale to match Vsystem_time_locale, if possible. */ 1936 /* Set system time locale to match Vsystem_time_locale, if possible. */
1941 void 1937 void
1942 synchronize_system_time_locale () 1938 synchronize_system_time_locale ()