diff options
| author | Jason Rumney | 2008-03-14 23:36:58 +0000 |
|---|---|---|
| committer | Jason Rumney | 2008-03-14 23:36:58 +0000 |
| commit | a03fc5a6e0b1ec5b2d63b9ba6973889322e63029 (patch) | |
| tree | 329d855b5ee70bf2a22ab9945d5632128de97bfb /src | |
| parent | 392640c4376b43617eaba89e3fde3c2a5d99a237 (diff) | |
| download | emacs-a03fc5a6e0b1ec5b2d63b9ba6973889322e63029.tar.gz emacs-a03fc5a6e0b1ec5b2d63b9ba6973889322e63029.zip | |
(initial_tz): New variable.
(syms_of_editfns): Initialize it.
(Fset_time_zone_rule): Set it when first called.
Use it when TZSTRING is nil.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c index 3126b3aa3e6..0ab1630df3c 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2011,6 +2011,11 @@ the data it can't find. */) | |||
| 2011 | has never been called. */ | 2011 | has never been called. */ |
| 2012 | static char **environbuf; | 2012 | static char **environbuf; |
| 2013 | 2013 | ||
| 2014 | /* This holds the startup value of the TZ environment variable so it | ||
| 2015 | can be restored if the user calls set-time-zone-rule with a nil | ||
| 2016 | argument. */ | ||
| 2017 | static char *initial_tz; | ||
| 2018 | |||
| 2014 | DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0, | 2019 | DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0, |
| 2015 | doc: /* Set the local time zone using TZ, a string specifying a time zone rule. | 2020 | doc: /* Set the local time zone using TZ, a string specifying a time zone rule. |
| 2016 | If TZ is nil, use implementation-defined default time zone information. | 2021 | If TZ is nil, use implementation-defined default time zone information. |
| @@ -2020,8 +2025,12 @@ If TZ is t, use Universal Time. */) | |||
| 2020 | { | 2025 | { |
| 2021 | char *tzstring; | 2026 | char *tzstring; |
| 2022 | 2027 | ||
| 2028 | /* When called for the first time, save the original TZ. */ | ||
| 2029 | if (!environbuf) | ||
| 2030 | initial_tz = (char *) getenv ("TZ"); | ||
| 2031 | |||
| 2023 | if (NILP (tz)) | 2032 | if (NILP (tz)) |
| 2024 | tzstring = 0; | 2033 | tzstring = initial_tz; |
| 2025 | else if (EQ (tz, Qt)) | 2034 | else if (EQ (tz, Qt)) |
| 2026 | tzstring = "UTC0"; | 2035 | tzstring = "UTC0"; |
| 2027 | else | 2036 | else |
| @@ -4588,6 +4597,7 @@ void | |||
| 4588 | syms_of_editfns () | 4597 | syms_of_editfns () |
| 4589 | { | 4598 | { |
| 4590 | environbuf = 0; | 4599 | environbuf = 0; |
| 4600 | initial_tz = 0; | ||
| 4591 | 4601 | ||
| 4592 | Qbuffer_access_fontify_functions | 4602 | Qbuffer_access_fontify_functions |
| 4593 | = intern ("buffer-access-fontify-functions"); | 4603 | = intern ("buffer-access-fontify-functions"); |