summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2008-03-14 23:36:58 +0000
committerJason Rumney <jasonr@gnu.org>2008-03-14 23:36:58 +0000
commita03fc5a6e0b1ec5b2d63b9ba6973889322e63029 (patch)
tree329d855b5ee70bf2a22ab9945d5632128de97bfb /src
parent392640c4376b43617eaba89e3fde3c2a5d99a237 (diff)
downloademacs-a03fc5a6e0b1ec5b2d63b9ba6973889322e63029.tar.gz
(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.c12
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. */)
has never been called. */
static char **environbuf;
+/* This holds the startup value of the TZ environment variable so it
+ can be restored if the user calls set-time-zone-rule with a nil
+ argument. */
+static char *initial_tz;
+
DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0,
doc: /* Set the local time zone using TZ, a string specifying a time zone rule.
If TZ is nil, use implementation-defined default time zone information.
@@ -2020,8 +2025,12 @@ If TZ is t, use Universal Time. */)
{
char *tzstring;
+ /* When called for the first time, save the original TZ. */
+ if (!environbuf)
+ initial_tz = (char *) getenv ("TZ");
+
if (NILP (tz))
- tzstring = 0;
+ tzstring = initial_tz;
else if (EQ (tz, Qt))
tzstring = "UTC0";
else
@@ -4588,6 +4597,7 @@ void
syms_of_editfns ()
{
environbuf = 0;
+ initial_tz = 0;
Qbuffer_access_fontify_functions
= intern ("buffer-access-fontify-functions");