Subject: Re: bug#40863: [PATCH] Improve the display-time-world UI

From: Stefan Kangas <[email-masked]>
Date: Sun, 9 Aug 2020 15:11:06 -0700

"Basil L. Contovounesios" <[email-masked]> writes:

>>  (define-derived-mode display-time-world-mode special-mode "World clock"
>>    "Major mode for buffer that displays times in various time zones.
>>  See `display-time-world'."
>> +  (setq revert-buffer-function 'display-time-world-timer)
>                                   ^
>                             Nit: #'
>
> More importantly, doesn't revert-buffer-function need two parameters?

Fixed.

>> Subject: [PATCH 3/3] Rearrange and clean up code in time.el (Bug#40863)
>>
>> * lisp/time.el (world-clock, zoneinfo-style-world-list)
>> (legacy-style-world-list, world-clock-list)
>> (time--display-world-list, world-clock-time-format)
>> (world-clock-timer-enable, world-clock-timer-second): Move definitions
>> closer to 'world-clock' code.
>
> Unless I'm misreading it, the patch you attached seems to be adding
> duplicate definitions rather than moving them.

Uhm, right... Fixed in the attached.

Thanks again for the review.

Best regards,
Stefan Kangas
From c7bb644998bed7262d491dd7c73af2ed34b5ca43 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sun, 26 Apr 2020 10:16:06 +0200
Subject: [PATCH 1/3] Improve display-time-world UI (Bug#40863)

* lisp/time.el (display-time-world-mode): Set 'revert-buffer-function'
to 'display-time-world-timer'.

(display-time-world-label): New face.
(display-time-world-display): Use the new face.  Move point to new
buffer on creation and resize.
---
 lisp/time.el | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/lisp/time.el b/lisp/time.el
index 44fd1a7e33..3625940334 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -509,9 +509,14 @@ display-time-mode
 		 'display-time-event-handler)))

+(defface display-time-world-label
+  '((t :inherit font-lock-variable-name-face))
+  "Face for time zone label.")
+
 (define-derived-mode display-time-world-mode special-mode "World clock"
   "Major mode for buffer that displays times in various time zones.
 See `display-time-world'."
+  (setq revert-buffer-function #'display-time-world-timer)
   (setq show-trailing-whitespace nil))
 
 (defun display-time-world-display (alist)
@@ -533,7 +538,10 @@ display-time-world-display
 	  (setq max-width width))))
     (setq fmt (concat "%-" (int-to-string max-width) "s %s\n"))
     (dolist (timedata (nreverse result))
-      (insert (format fmt (car timedata) (cdr timedata))))
+      (insert (format fmt
+                      (propertize (car timedata)
+                                  'face 'display-time-world-label)
+                      (cdr timedata))))
     (delete-char -1))
   (goto-char (point-min)))
 
@@ -541,18 +549,17 @@ display-time-world-display
 (defun display-time-world ()
   "Enable updating display of times in various time zones.
 `display-time-world-list' specifies the zones.
-To turn off the world time display, go to that window and type `q'."
+To turn off the world time display, go to that window and type `\\[quit-window]'."
   (interactive)
   (when (and display-time-world-timer-enable
              (not (get-buffer display-time-world-buffer-name)))
     (run-at-time t display-time-world-timer-second 'display-time-world-timer))
-  (with-current-buffer (get-buffer-create display-time-world-buffer-name)
-    (display-time-world-display (time--display-world-list))
-    (display-buffer display-time-world-buffer-name
-		    (cons nil '((window-height . fit-window-to-buffer))))
-    (display-time-world-mode)))
+  (pop-to-buffer display-time-world-buffer-name)
+  (display-time-world-display (time--display-world-list))
+  (display-time-world-mode)
+  (fit-window-to-buffer))
 
-(defun display-time-world-timer ()
+(defun display-time-world-timer (&optional _arg _noconfirm)
   (if (get-buffer display-time-world-buffer-name)
       (with-current-buffer (get-buffer display-time-world-buffer-name)
         (display-time-world-display (time--display-world-list)))
-- 
2.28.0

From 52a02e6d159d93f9d707ea9e5d40a05f290ac1f9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sat, 2 May 2020 16:08:33 +0200
Subject: [PATCH 2/3] Rename 'display-time-world' to 'world-clock' (Bug#40863)

* lisp/time.el (world-clock-list, world-clock-time-format)
(world-clock-buffer-name, world-clock-timer-enable)
(world-clock-timer-second, world-clock-label, world-clock-mode)
(world-clock-display, world-clock, world-clock-update): Rename
from 'display-time-world-*' and update all uses.

(world-clock): New defgroup.
(zoneinfo-style-world-list, legacy-style-world-list): Use :group
'world-clock'.

(display-time-world-list, display-time-world-time-format)
(display-time-world-buffer-name)
(display-time-world-timer-enable)
(display-time-world-timer-second): Make into obsolete variable
aliases for the new names.

* lisp/time.el (display-time-world-mode)
(display-time-world-display, display-time-world)
(display-time-world-timer): Make into obsolete function aliases
for the new names.

* etc/NEWS: Announce the above changes.
---
 etc/NEWS     |  25 ++++++++++
 lisp/time.el | 134 +++++++++++++++++++++++++++++++--------------------
 2 files changed, 106 insertions(+), 53 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e3d7ff0bef..9078cd3a7a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -754,6 +754,31 @@ never be narrower than 19 characters.
 When the 'bookmark.el' library is loaded, a customize choice is added
 to 'tab-bar-new-tab-choice' for new tabs to show the bookmark list.
 
+** Time
+
+---
+*** 'display-time-world' has been renamed to 'world-clock'.
+'world-clock' creates a buffer with an updating time display using
+several time zones.  It is hoped that the new names are more
+discoverable.
+
+The following functions have been renamed:
+
+  'display-time-world'         to 'world-clock'
+  'display-time-world-mode'    to 'world-clock-mode'
+  'display-time-world-display' to 'world-clock-display'
+  'display-time-world-timer'   to 'world-clock-update'
+
+The following options have been renamed:
+
+  'display-time-world-list'         to 'world-clock-list'
+  'display-time-world-time-format'  to 'world-clock-time-format'
+  'display-time-world-buffer-name'  to 'world-clock-buffer-name'
+  'display-time-world-timer-enable' to 'world-clock-timer-enable'
+  'display-time-world-timer-second' to 'world-clock-timer-second'
+
+The old names are now obsolete.
+
 
 * New Modes and Packages in Emacs 28.1
 
diff --git a/lisp/time.el b/lisp/time.el
index 3625940334..fe918c5400 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -25,8 +25,7 @@
 ;; Facilities to display current time/date and a new-mail indicator
 ;; in the Emacs mode line.  The entry point is `display-time'.
 
-;; Display time world in a buffer, the entry point is
-;; `display-time-world'.
+;; Use `world-clock' to display world clock in a buffer.
 
 ;;; Code:
 
@@ -123,6 +122,10 @@ display-time-server-down-time
    "Time when mail file's file system was recorded to be down.
 If that file system seems to be up, the value is nil.")
 
+(defgroup world-clock nil
+  "Display a world clock."
+  :group 'display-time)
+
 (defcustom zoneinfo-style-world-list
   '(("America/Los_Angeles" "Seattle")
     ("America/New_York" "New York")
@@ -130,13 +133,13 @@ zoneinfo-style-world-list
     ("Europe/Paris" "Paris")
     ("Asia/Calcutta" "Bangalore")
     ("Asia/Tokyo" "Tokyo"))
-  "Alist of zoneinfo-style time zones and places for `display-time-world'.
+  "Alist of zoneinfo-style time zones and places for `world-clock'.
 Each element has the form (TIMEZONE LABEL).
 TIMEZONE should be a string of the form AREA/LOCATION, where AREA is
 the name of a region -- a continent or ocean, and LOCATION is the name
 of a specific location, e.g., a city, within that region.
 LABEL is a string to display as the label of that TIMEZONE's time."
-  :group 'display-time
+  :group 'world-clock
   :type '(repeat (list string string))
   :version "23.1")
 
@@ -147,7 +150,7 @@ legacy-style-world-list
     ("CET-1CDT" "Paris")
     ("IST-5:30" "Bangalore")
     ("JST-9" "Tokyo"))
-  "Alist of traditional-style time zones and places for `display-time-world'.
+  "Alist of traditional-style time zones and places for `world-clock'.
 Each element has the form (TIMEZONE LABEL).
 TIMEZONE should be a string of the form:
 
@@ -156,12 +159,12 @@ legacy-style-world-list
 See the documentation of the TZ environment variable on your system,
 for more details about the format of TIMEZONE.
 LABEL is a string to display as the label of that TIMEZONE's time."
-  :group 'display-time
+  :group 'world-clock
   :type '(repeat (list string string))
   :version "23.1")
 
-(defcustom display-time-world-list t
-  "Alist of time zones and places for `display-time-world' to display.
+(defcustom world-clock-list t
+  "Alist of time zones and places for `world-clock' to display.
 Each element has the form (TIMEZONE LABEL).
 TIMEZONE should be in a format supported by your system.  See the
 documentation of `zoneinfo-style-world-list' and
@@ -171,16 +174,15 @@ display-time-world-list
 If the value is t instead of an alist, use the value of
 `zoneinfo-style-world-list' if it works on this platform, and of
 `legacy-style-world-list' otherwise."
-
-  :group 'display-time
+  :group 'world-clock
   :type '(choice (const :tag "Default" t)
                  (repeat :tag "List of zones and labels"
                          (list (string :tag "Zone") (string :tag "Label"))))
-  :version "23.1")
+  :version "28.1")
 
 (defun time--display-world-list ()
-  (if (listp display-time-world-list)
-      display-time-world-list
+  (if (listp world-clock-list)
+      world-clock-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"))
@@ -189,29 +191,29 @@ time--display-world-list
 	  legacy-style-world-list
 	zoneinfo-style-world-list))))
 
-(defcustom display-time-world-time-format "%A %d %B %R %Z"
-  "Format of the time displayed, see `format-time-string'."
-  :group 'display-time
+(defcustom world-clock-time-format "%A %d %B %R %Z"
+  "Time format for `world-clock', see `format-time-string'."
+  :group 'world-clock
   :type 'string
-  :version "23.1")
+  :version "28.1")
 
-(defcustom display-time-world-buffer-name "*wclock*"
-  "Name of the world clock buffer."
-  :group 'display-time
+(defcustom world-clock-buffer-name "*wclock*"
+  "Name of the `world-clock' buffer."
+  :group 'world-clock
   :type 'string
-  :version "23.1")
+  :version "28.1")
 
-(defcustom display-time-world-timer-enable t
-  "If non-nil, a timer will update the world clock."
-  :group 'display-time
+(defcustom world-clock-timer-enable t
+  "If non-nil, a timer will update the `world-clock' buffer."
+  :group 'world-clock
   :type 'boolean
-  :version "23.1")
+  :version "28.1")
 
-(defcustom display-time-world-timer-second 60
-  "Interval in seconds for updating the world clock."
-  :group 'display-time
+(defcustom world-clock-timer-second 60
+  "Interval in seconds for updating the `world-clock' buffer."
+  :group 'world-clock
   :type 'integer
-  :version "23.1")
+  :version "28.1")
 
 ;;;###autoload
 (defun display-time ()
@@ -508,18 +510,43 @@ display-time-mode
     (remove-hook 'rmail-after-get-new-mail-hook
 		 'display-time-event-handler)))
 
-
-(defface display-time-world-label
+
+;;; Obsolete names
+
+(define-obsolete-variable-alias 'display-time-world-list
+  'world-clock-list "28.1")
+(define-obsolete-variable-alias 'display-time-world-time-format
+  'world-clock-time-format "28.1")
+(define-obsolete-variable-alias 'display-time-world-buffer-name
+  'world-clock-buffer-name "28.1")
+(define-obsolete-variable-alias 'display-time-world-timer-enable
+  'world-clock-timer-enable "28.1")
+(define-obsolete-variable-alias 'display-time-world-timer-second
+  'world-clock-timer-second "28.1")
+
+(define-obsolete-function-alias 'display-time-world-mode
+  #'world-clock-mode "28.1")
+(define-obsolete-function-alias 'display-time-world-display
+  #'world-clock-display "28.1")
+(define-obsolete-function-alias 'display-time-world
+  #'world-clock "28.1")
+(define-obsolete-function-alias 'display-time-world-timer
+  #'world-clock-update "28.1")
+
+
+;;; World clock
+
+(defface world-clock-label
   '((t :inherit font-lock-variable-name-face))
-  "Face for time zone label.")
+  "Face for time zone label in `world-clock' buffer.")
 
-(define-derived-mode display-time-world-mode special-mode "World clock"
+(define-derived-mode world-clock-mode special-mode "World clock"
   "Major mode for buffer that displays times in various time zones.
-See `display-time-world'."
-  (setq revert-buffer-function #'display-time-world-timer)
+See `world-clock'."
+  (setq revert-buffer-function #'world-clock-update)
   (setq show-trailing-whitespace nil))
 
-(defun display-time-world-display (alist)
+(defun world-clock-display (alist)
   "Replace current buffer text with times in various zones, based on ALIST."
   (let ((inhibit-read-only t)
 	(buffer-undo-list t)
@@ -531,7 +558,7 @@ display-time-world-display
       (let* ((label (cadr zone))
 	     (width (string-width label)))
 	(push (cons label
-		    (format-time-string display-time-world-time-format
+		    (format-time-string world-clock-time-format
 					now (car zone)))
 	      result)
 	(when (> width max-width)
@@ -540,35 +567,36 @@ display-time-world-display
     (dolist (timedata (nreverse result))
       (insert (format fmt
                       (propertize (car timedata)
-                                  'face 'display-time-world-label)
+                                  'face 'world-clock-label)
                       (cdr timedata))))
     (delete-char -1))
   (goto-char (point-min)))
 
 ;;;###autoload
-(defun display-time-world ()
-  "Enable updating display of times in various time zones.
-`display-time-world-list' specifies the zones.
-To turn off the world time display, go to that window and type `\\[quit-window]'."
+(defun world-clock ()
+  "Display a world clock buffer with times in various time zones.
+The variable `world-clock-list' specifies which time zones to use.
+To turn off the world time display, go to the window and type `\\[quit-window]'."
   (interactive)
-  (when (and display-time-world-timer-enable
-             (not (get-buffer display-time-world-buffer-name)))
-    (run-at-time t display-time-world-timer-second 'display-time-world-timer))
-  (pop-to-buffer display-time-world-buffer-name)
-  (display-time-world-display (time--display-world-list))
-  (display-time-world-mode)
+  (when (and world-clock-timer-enable
+             (not (get-buffer world-clock-buffer-name)))
+    (run-at-time t world-clock-timer-second #'world-clock-update))
+  (pop-to-buffer world-clock-buffer-name)
+  (world-clock-display (time--display-world-list))
+  (world-clock-mode)
   (fit-window-to-buffer))
 
-(defun display-time-world-timer (&optional _arg _noconfirm)
-  (if (get-buffer display-time-world-buffer-name)
-      (with-current-buffer (get-buffer display-time-world-buffer-name)
-        (display-time-world-display (time--display-world-list)))
+(defun world-clock-update (&optional _arg _noconfirm)
+  "Update the `world-clock' buffer."
+  (if (get-buffer world-clock-buffer-name)
+      (with-current-buffer (get-buffer world-clock-buffer-name)
+        (world-clock-display (time--display-world-list)))
     ;; cancel timer
     (let ((list timer-list))
       (while list
         (let ((elt (pop list)))
           (when (equal (symbol-name (timer--function elt))
-		       "display-time-world-timer")
+		       "world-clock-update")
             (cancel-timer elt)))))))
 
 ;;;###autoload
-- 
2.28.0

From df1d9b2470a4a39c909bea69c9b8dcc6427c1566 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sun, 9 Aug 2020 23:42:06 +0200
Subject: [PATCH 3/3] Rearrange and clean up code in time.el (Bug#40863)

* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code.  Remove redundant :group args.

(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
---
 lisp/time.el | 215 +++++++++++++++++++++++----------------------------
 1 file changed, 97 insertions(+), 118 deletions(-)

diff --git a/lisp/time.el b/lisp/time.el
index fe918c5400..96b49ddabd 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -34,23 +34,20 @@ display-time
   :group 'mode-line
   :group 'mail)
 
-
 (defcustom display-time-mail-file nil
   "File name of mail inbox file, for indicating existence of new mail.
 Non-nil and not a string means don't check for mail; nil means use
 default, which is system-dependent, and is the same as used by Rmail."
   :type '(choice (const :tag "None" none)
 		 (const :tag "Default" nil)
-		 (file :format "%v"))
-  :group 'display-time)
+		 (file :format "%v")))
 
 (defcustom display-time-mail-directory nil
   "Name of mail inbox directory, for indicating existence of new mail.
 Any nonempty regular file in the directory is regarded as newly arrived mail.
 If nil, do not check a directory for arriving mail."
   :type '(choice (const :tag "None" nil)
-		 (directory :format "%v"))
-  :group 'display-time)
+		 (directory :format "%v")))
 
 (defcustom display-time-mail-function nil
   "Function to call, for indicating existence of new mail.
@@ -58,8 +55,7 @@ display-time-mail-function
 specified by `display-time-mail-file' is nonempty or that the
 directory `display-time-mail-directory' contains nonempty files."
   :type '(choice (const :tag "Default" nil)
-		 (function))
-  :group 'display-time)
+		 (function)))
 
 (defcustom display-time-default-load-average 0
   "Which load average value will be shown in the mode line.
@@ -74,8 +70,7 @@ display-time-default-load-average
   :type '(choice (const :tag "1 minute load" 0)
 		 (const :tag "5 minutes load" 1)
 		 (const :tag "15 minutes load" 2)
-		 (const :tag "None" nil))
-  :group 'display-time)
+		 (const :tag "None" nil)))
 
 (defvar display-time-load-average nil
   "Value of the system's load average currently shown on the mode line.
@@ -85,27 +80,23 @@ display-time-load-average
 
 (defcustom display-time-load-average-threshold 0.1
   "Load-average values below this value won't be shown in the mode line."
-  :type 'number
-  :group 'display-time)
+  :type 'number)
 
 ;;;###autoload
 (defcustom display-time-day-and-date nil "\
 Non-nil means \\[display-time] should display day and date as well as time."
-  :type 'boolean
-  :group 'display-time)
+  :type 'boolean)
 
 (defvar display-time-timer nil)
 
 (defcustom display-time-interval 60
   "Seconds between updates of time in the mode line."
-  :type 'integer
-  :group 'display-time)
+  :type 'integer)
 
 (defcustom display-time-24hr-format nil
   "Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23.
 A value of nil means 1 <= hh <= 12, and an AM/PM suffix is used."
-  :type 'boolean
-  :group 'display-time)
+  :type 'boolean)
 
 (defvar display-time-string nil
   "String used in mode lines to display a time string.
@@ -115,106 +106,12 @@ display-time-string
 
 (defcustom display-time-hook nil
   "List of functions to be called when the time is updated on the mode line."
-  :type 'hook
-  :group 'display-time)
+  :type 'hook)
 
 (defvar display-time-server-down-time nil
    "Time when mail file's file system was recorded to be down.
 If that file system seems to be up, the value is nil.")
 
-(defgroup world-clock nil
-  "Display a world clock."
-  :group 'display-time)
-
-(defcustom zoneinfo-style-world-list
-  '(("America/Los_Angeles" "Seattle")
-    ("America/New_York" "New York")
-    ("Europe/London" "London")
-    ("Europe/Paris" "Paris")
-    ("Asia/Calcutta" "Bangalore")
-    ("Asia/Tokyo" "Tokyo"))
-  "Alist of zoneinfo-style time zones and places for `world-clock'.
-Each element has the form (TIMEZONE LABEL).
-TIMEZONE should be a string of the form AREA/LOCATION, where AREA is
-the name of a region -- a continent or ocean, and LOCATION is the name
-of a specific location, e.g., a city, within that region.
-LABEL is a string to display as the label of that TIMEZONE's time."
-  :group 'world-clock
-  :type '(repeat (list string string))
-  :version "23.1")
-
-(defcustom legacy-style-world-list
-  '(("PST8PDT" "Seattle")
-    ("EST5EDT" "New York")
-    ("GMT0BST" "London")
-    ("CET-1CDT" "Paris")
-    ("IST-5:30" "Bangalore")
-    ("JST-9" "Tokyo"))
-  "Alist of traditional-style time zones and places for `world-clock'.
-Each element has the form (TIMEZONE LABEL).
-TIMEZONE should be a string of the form:
-
-     std[+|-]offset[dst[offset][,date[/time],date[/time]]]
-
-See the documentation of the TZ environment variable on your system,
-for more details about the format of TIMEZONE.
-LABEL is a string to display as the label of that TIMEZONE's time."
-  :group 'world-clock
-  :type '(repeat (list string string))
-  :version "23.1")
-
-(defcustom world-clock-list t
-  "Alist of time zones and places for `world-clock' to display.
-Each element has the form (TIMEZONE LABEL).
-TIMEZONE should be in a format supported by your system.  See the
-documentation of `zoneinfo-style-world-list' and
-`legacy-style-world-list' for two widely used formats.  LABEL is
-a string to display as the label of that TIMEZONE's time.
-
-If the value is t instead of an alist, use the value of
-`zoneinfo-style-world-list' if it works on this platform, and of
-`legacy-style-world-list' otherwise."
-  :group 'world-clock
-  :type '(choice (const :tag "Default" t)
-                 (repeat :tag "List of zones and labels"
-                         (list (string :tag "Zone") (string :tag "Label"))))
-  :version "28.1")
-
-(defun time--display-world-list ()
-  (if (listp world-clock-list)
-      world-clock-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))))
-
-(defcustom world-clock-time-format "%A %d %B %R %Z"
-  "Time format for `world-clock', see `format-time-string'."
-  :group 'world-clock
-  :type 'string
-  :version "28.1")
-
-(defcustom world-clock-buffer-name "*wclock*"
-  "Name of the `world-clock' buffer."
-  :group 'world-clock
-  :type 'string
-  :version "28.1")
-
-(defcustom world-clock-timer-enable t
-  "If non-nil, a timer will update the `world-clock' buffer."
-  :group 'world-clock
-  :type 'boolean
-  :version "28.1")
-
-(defcustom world-clock-timer-second 60
-  "Interval in seconds for updating the `world-clock' buffer."
-  :group 'world-clock
-  :type 'integer
-  :version "28.1")
-
 ;;;###autoload
 (defun display-time ()
   "Enable display of time, load level, and mail flag in mode lines.
@@ -251,14 +148,12 @@ display-time-use-mail-icon
   "Non-nil means use an icon as mail indicator on a graphic display.
 Otherwise use `display-time-mail-string'.  The icon may consume less
 of the mode line.  It is specified by `display-time-mail-icon'."
-  :group 'display-time
   :type 'boolean)
 
 ;; Fixme: maybe default to the character if we can display Unicode.
 (defcustom display-time-mail-string "Mail"
   "String to use as the mail indicator in `display-time-string-forms'.
 This can use the Unicode letter character if you can display it."
-  :group 'display-time
   :version "22.1"
   :type '(choice (const "Mail")
 		 ;; Use :tag here because the Lucid menu won't display
@@ -272,8 +167,7 @@ display-time-format
 how to write this string.  If this is nil, the defaults
 depend on `display-time-day-and-date' and `display-time-24hr-format'."
   :type '(choice (const :tag "Default" nil)
-		 string)
-  :group 'display-time)
+		 string))
 
 (defcustom display-time-string-forms
   '((if (and (not display-time-format) display-time-day-and-date)
@@ -327,8 +221,7 @@ display-time-string-forms
     (if mail \" Mail\" \"\"))
 
 would give mode line times like `94/12/30 21:07:48 (UTC)'."
-  :type '(repeat sexp)
-  :group 'display-time)
+  :type '(repeat sexp))
 
 (defun display-time-event-handler ()
   (display-time-update)
@@ -536,6 +429,92 @@ 'display-time-world-timer
 
 ;;; World clock
 
+(defgroup world-clock nil
+  "Display a world clock."
+  :group 'display-time)
+
+(defcustom zoneinfo-style-world-list
+  '(("America/Los_Angeles" "Seattle")
+    ("America/New_York" "New York")
+    ("Europe/London" "London")
+    ("Europe/Paris" "Paris")
+    ("Asia/Calcutta" "Bangalore")
+    ("Asia/Tokyo" "Tokyo"))
+  "Alist of zoneinfo-style time zones and places for `world-clock'.
+Each element has the form (TIMEZONE LABEL).
+TIMEZONE should be a string of the form AREA/LOCATION, where AREA is
+the name of a region -- a continent or ocean, and LOCATION is the name
+of a specific location, e.g., a city, within that region.
+LABEL is a string to display as the label of that TIMEZONE's time."
+  :type '(repeat (list string string))
+  :version "23.1")
+
+(defcustom legacy-style-world-list
+  '(("PST8PDT" "Seattle")
+    ("EST5EDT" "New York")
+    ("GMT0BST" "London")
+    ("CET-1CDT" "Paris")
+    ("IST-5:30" "Bangalore")
+    ("JST-9" "Tokyo"))
+  "Alist of traditional-style time zones and places for `world-clock'.
+Each element has the form (TIMEZONE LABEL).
+TIMEZONE should be a string of the form:
+
+     std[+|-]offset[dst[offset][,date[/time],date[/time]]]
+
+See the documentation of the TZ environment variable on your system,
+for more details about the format of TIMEZONE.
+LABEL is a string to display as the label of that TIMEZONE's time."
+  :type '(repeat (list string string))
+  :version "23.1")
+
+(defcustom world-clock-list t
+  "Alist of time zones and places for `world-clock' to display.
+Each element has the form (TIMEZONE LABEL).
+TIMEZONE should be in a format supported by your system.  See the
+documentation of `zoneinfo-style-world-list' and
+`legacy-style-world-list' for two widely used formats.  LABEL is
+a string to display as the label of that TIMEZONE's time.
+
+If the value is t instead of an alist, use the value of
+`zoneinfo-style-world-list' if it works on this platform, and of
+`legacy-style-world-list' otherwise."
+  :type '(choice (const :tag "Default" t)
+                 (repeat :tag "List of zones and labels"
+                         (list (string :tag "Zone") (string :tag "Label"))))
+  :version "28.1")
+
+(defun time--display-world-list ()
+  (if (listp world-clock-list)
+      world-clock-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))))
+
+(defcustom world-clock-time-format "%A %d %B %R %Z"
+  "Time format for `world-clock', see `format-time-string'."
+  :type 'string
+  :version "28.1")
+
+(defcustom world-clock-buffer-name "*wclock*"
+  "Name of the `world-clock' buffer."
+  :type 'string
+  :version "28.1")
+
+(defcustom world-clock-timer-enable t
+  "If non-nil, a timer will update the `world-clock' buffer."
+  :type 'boolean
+  :version "28.1")
+
+(defcustom world-clock-timer-second 60
+  "Interval in seconds for updating the `world-clock' buffer."
+  :type 'integer
+  :version "28.1")
+
 (defface world-clock-label
   '((t :inherit font-lock-variable-name-face))
   "Face for time zone label in `world-clock' buffer.")
-- 
2.28.0