From 9dad26961ac402d59f3c20ad9c03a741de664d80 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 24 Nov 2021 21:16:21 +0100 Subject: [PATCH] fix: envvar file loader processing TZ incorrectly setenv treats the TZ (and only TZ) envvar especially, so we have to too, since I'm intentionally avoiding iteratively setenv'ing envvars to avoid the unnecessary extra work it does. Fix: #5760 --- core/core-lib.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/core/core-lib.el b/core/core-lib.el index 66ae5bae8..04405468a 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -125,15 +125,19 @@ unreadable. Returns the names of envvars that were changed." (with-temp-buffer (insert-file-contents file) (when-let (env (read (current-buffer))) - (setq-default - process-environment - (append env (default-value 'process-environment)) - exec-path - (append (split-string (getenv "PATH") path-separator t) - (list exec-directory)) - shell-file-name - (or (getenv "SHELL") - (default-value 'shell-file-name))) + (let ((tz (getenv-internal "TZ"))) + (setq-default + process-environment + (append env (default-value 'process-environment)) + exec-path + (append (split-string (getenv "PATH") path-separator t) + (list exec-directory)) + shell-file-name + (or (getenv "SHELL") + (default-value 'shell-file-name))) + (when-let (newtz (getenv-internal "TZ")) + (unless (equal tz newtz) + (set-time-zone-rule newtz)))) env)))) (defun doom-run-hook (hook)