summaryrefslogtreecommitdiff
path: root/helm-misc.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2018-03-12 08:37:42 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2018-03-12 08:40:32 +0100
commit67f87716ffc5d875373a2bb691c732a8f4d1493b (patch)
tree51bbfa2186d6dc0ee4e5157183006533a277c746 /helm-misc.el
parent97bc8c4cdd2a80f12378c6cb4eaf60afdfd910eb (diff)
Fix compatibility with emacs-26 in helm-world-time (#1986)
* helm-misc.el (helm-source-time-world): Inline time--display-world-list definition to setup display-time-world-list.
Diffstat (limited to 'helm-misc.el')
-rw-r--r--helm-misc.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/helm-misc.el b/helm-misc.el
index 11156484..2b2ae71c 100644
--- a/helm-misc.el
+++ b/helm-misc.el
@@ -99,6 +99,9 @@
;;; World time
;;
+(defvar zoneinfo-style-world-list)
+(defvar legacy-style-world-list)
+
(defun helm-time-zone-transformer (candidates _source)
(cl-loop for i in candidates
for (z . p) in display-time-world-list
@@ -113,7 +116,22 @@
(defvar helm-source-time-world
(helm-build-in-buffer-source "Time World List"
- :init (lambda () (require 'time))
+ :init (lambda ()
+ (require 'time)
+ (setq display-time-world-list
+ ;; inlined from `time--display-world-list' from
+ ;; emacs-27 for compatibility as
+ ;; `display-time-world-list' is set by default to
+ ;; `t' on emacs-26+...
+ (if (listp display-time-world-list)
+ display-time-world-list
+ ;; Determine if zoneinfo style timezones are supported by testing that
+ ;; America/New York and Europe/London return different timezones.
+ (let ((nyt (format-time-string "%z" nil "America/New_York"))
+ (gmt (format-time-string "%z" nil "Europe/London")))
+ (if (string-equal nyt gmt)
+ legacy-style-world-list
+ zoneinfo-style-world-list)))))
:data (lambda ()
(with-temp-buffer
(display-time-world-display display-time-world-list)