all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 40863@debbugs.gnu.org
Subject: bug#40863: [PATCH] Improve the display-time-world UI
Date: Sat, 02 May 2020 18:10:19 +0200	[thread overview]
Message-ID: <87k11u48t0.fsf@stefankangas.se> (raw)
In-Reply-To: <874kt4y1rc.fsf@tcd.ie> (Basil L. Contovounesios's message of "Mon, 27 Apr 2020 23:58:31 +0100")

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> I have made some improvements to the display-time-world UI.  I divided
>> them up into four patches to ease review and merging of the individual
>> features.  Please let me know what you think.
>
> Thanks for working on this, see my comments below.
>
>> (Of course I can squash the patches before pushing if that is preferable.)
>>
>> Patch 4 adds an alias 'world-clock'.  Ideally, I would like to rename
>> the somewhat obscurely named 'display-world-time' to 'world-clock' and
>> make the old names into obsolete aliases.  It would be good to hear
>> any opinions on that too.
>
> No strong feelings either way here.

So here's a revised set of patches:

1. Fix all Basil's comments, and remove the buffer rename that Eli
   didn't approve of.

2. Rename 'display-time-world' to 'world-clock', and add an alias for
   the old name.

Then comes the more ambitious part:

3. Rename 'display-time-world-*' functions and variables into
   'world-clock-*' equivalents and make the old names into obsolete
   aliases.

   Move the world-clock options from the defgroup display-time
   (sorting under the mode-line and mail), into a new defgroup
   world-clock (sorting under applications).

4. Rearrange the defcustoms time.el to clearly separate world-clock
   from display-time-mode.  Cleanup of :group args.

I have seen no to the proposals in patches 1-2 so far, and I hope that
we can agree to make the changes also in patches 3-4. I think the
result is much more logical from pretty much any point of view.

Comments are obviously very welcome.

Best regards,
Stefan Kangas


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-display-time-world-UI-Bug-40863.patch --]
[-- Type: text/x-diff, Size: 2978 bytes --]

From e4e5012abdece7ce334900fd45f7e5ba06185ecc Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sun, 26 Apr 2020 10:16:06 +0200
Subject: [PATCH 1/4] Improve display-time-world UI (Bug#40863)

* lisp/time.el (display-time-world-label): New face.
(display-time-world-display): Use the new face.  Move point to new
buffer on creation.
(display-time-world-mode-map): New variable.  Bind 'g' to update the
display-time-world buffer.
(display-time-world-timer): Add interactive spec.
---
 lisp/time.el | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/lisp/time.el b/lisp/time.el
index 44fd1a7e33..7e26c131c9 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -509,6 +509,16 @@ display-time-mode
 		 'display-time-event-handler)))
 
 
+(defface display-time-world-label
+  '((t :inherit font-lock-variable-name-face))
+  "Face for time zone label.")
+
+(defvar display-time-world-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "g" #'display-time-world-timer)
+    map)
+  "Keymap for `display-time-world-mode'.")
+
 (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'."
@@ -533,7 +543,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 +554,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))
 
 (defun display-time-world-timer ()
+  (interactive)
   (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.26.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Make-display-time-world-into-an-alias-for-world-cloc.patch --]
[-- Type: text/x-diff, Size: 5301 bytes --]

From cd4c79a5758f0b6b8f5cc8acde62f806a1452b64 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sat, 2 May 2020 16:08:33 +0200
Subject: [PATCH 2/4] Make 'display-time-world' into an alias for 'world-clock'
 (Bug#40863)

* lisp/time.el (world-clock): Rename from 'display-time-world'.
(display-time-world): Redefine as alias for 'world-clock'.
* etc/NEWS: Announce the above change.

(top-level, zoneinfo-style-world-list, legacy-style-world-list)
(display-time-world-list, display-time-world-time-format)
(display-time-world-buffer-name)
(display-time-world-timer-enable)
(display-time-world-timer-second, display-time-world-label)
(display-time-world-timer): Update documentation to match the above
rename.
---
 etc/NEWS     |  7 +++++++
 lisp/time.el | 26 ++++++++++++++------------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 025d5c14a7..d2b745c579 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -288,6 +288,13 @@ prefix on the Subject line in various languages.
 These new navigation commands are bound to 'n' and 'p' in
 'apropos-mode'.
 
+** Time
+
+---
+*** 'display-time-world' is now an alias for 'world-clock'.
+'world-clock' creates a buffer with an updating time display using
+several time zones.  The new name is hoped to be more discoverable.
+
 \f
 * New Modes and Packages in Emacs 28.1
 
diff --git a/lisp/time.el b/lisp/time.el
index 7e26c131c9..fe290ff71f 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:
 
@@ -130,7 +129,7 @@ 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
@@ -147,7 +146,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:
 
@@ -161,7 +160,7 @@ legacy-style-world-list
   :version "23.1")
 
 (defcustom display-time-world-list t
-  "Alist of time zones and places for `display-time-world' to display.
+  "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
@@ -190,25 +189,25 @@ time--display-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'."
+  "Time format for `world-clock', see `format-time-string'."
   :group 'display-time
   :type 'string
   :version "23.1")
 
 (defcustom display-time-world-buffer-name "*wclock*"
-  "Name of the world clock buffer."
+  "Name of the `world-clock' buffer."
   :group 'display-time
   :type 'string
   :version "23.1")
 
 (defcustom display-time-world-timer-enable t
-  "If non-nil, a timer will update the world clock."
+  "If non-nil, a timer will update the `world-clock' buffer."
   :group 'display-time
   :type 'boolean
   :version "23.1")
 
 (defcustom display-time-world-timer-second 60
-  "Interval in seconds for updating the world clock."
+  "Interval in seconds for updating the `world-clock' buffer."
   :group 'display-time
   :type 'integer
   :version "23.1")
@@ -511,7 +510,7 @@ display-time-mode
 
 (defface display-time-world-label
   '((t :inherit font-lock-variable-name-face))
-  "Face for time zone label.")
+  "Face for time zone label in `world-clock' buffer.")
 
 (defvar display-time-world-mode-map
   (let ((map (make-sparse-keymap)))
@@ -551,8 +550,8 @@ display-time-world-display
   (goto-char (point-min)))
 
 ;;;###autoload
-(defun display-time-world ()
-  "Enable updating display of times in various time zones.
+(defun world-clock ()
+  "Show world clock buffer with 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]'."
   (interactive)
@@ -564,6 +563,7 @@ display-time-world
   (display-time-world-mode))
 
 (defun display-time-world-timer ()
+  "Update the `world-clock' buffer."
   (interactive)
   (if (get-buffer display-time-world-buffer-name)
       (with-current-buffer (get-buffer display-time-world-buffer-name)
@@ -576,6 +576,8 @@ display-time-world-timer
 		       "display-time-world-timer")
             (cancel-timer elt)))))))
 
+(defalias 'display-time-world #'world-clock)
+
 ;;;###autoload
 (defun emacs-uptime (&optional format)
   "Return a string giving the uptime of this instance of Emacs.
-- 
2.26.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Rename-display-time-world-to-world-clock-Bug-40863.patch --]
[-- Type: text/x-diff, Size: 10583 bytes --]

From 043650acccd2528c5459c3c854cbd886acae9642 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sat, 2 May 2020 17:26:14 +0200
Subject: [PATCH 3/4] Rename 'display-time-world' to 'world-clock' (Bug#40863)

* lisp/time.el (world-clock): New defgroup.
(zoneinfo-style-world-list, legacy-style-world-list): Use :group
'world-clock'.
(world-clock-list, world-clock-time-format)
(world-clock-buffer-name, world-clock-timer-enable)
(world-clock-timer-second): Rename from 'display-time-world-*'.
Use :group 'world-clock'.
(world-clock-label, world-clock-mode-map, world-clock-mode)
(world-clock-display, world-clock): Rename from
'display-time-world-*'.  Use the new names.
(time--display-world-list): Use the above new names.

(display-time-world-list, display-time-world-time-format)
(display-time-world-buffer-name)
(display-time-world-timer-enable)
(display-time-world-timer-second): Redefine as obsolete variable
aliases for the new 'world-clock-*' names.

(display-time-world-mode, display-time-world-display)
(display-time-world, display-time-world-timer): Redefine as
obsolete function aliases for the new 'world-clock-*' names.

* etc/NEWS: Announce the above changes.
---
 etc/NEWS     |  21 +++++++++-
 lisp/time.el | 114 +++++++++++++++++++++++++++++++--------------------
 2 files changed, 89 insertions(+), 46 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index d2b745c579..d97b148cc8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -291,9 +291,26 @@ These new navigation commands are bound to 'n' and 'p' in
 ** Time
 
 ---
-*** 'display-time-world' is now an alias for 'world-clock'.
+*** 'display-time-world' has been renamed to 'world-clock'.
 'world-clock' creates a buffer with an updating time display using
-several time zones.  The new name is hoped to be more discoverable.
+several time zones.
+
+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-namt'
+  'display-time-world-timer-enable' to 'world-clock-timer-enablt'
+  'display-time-world-timer-second' to 'world-clock-timer-secont'
+
+The old names are now obsolete.
 
 \f
 * New Modes and Packages in Emacs 28.1
diff --git a/lisp/time.el b/lisp/time.el
index fe290ff71f..3f1880b708 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -122,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
+  "Show a world clock."
+  :group 'applications)
+
 (defcustom zoneinfo-style-world-list
   '(("America/Los_Angeles" "Seattle")
     ("America/New_York" "New York")
@@ -135,7 +139,7 @@ zoneinfo-style-world-list
 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")
 
@@ -155,11 +159,11 @@ 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
+(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
@@ -170,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"))
@@ -188,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"
+(defcustom world-clock-time-format "%A %d %B %R %Z"
   "Time format for `world-clock', see `format-time-string'."
-  :group 'display-time
+  :group 'world-clock
   :type 'string
-  :version "23.1")
+  :version "28.1")
 
-(defcustom display-time-world-buffer-name "*wclock*"
+(defcustom world-clock-buffer-name "*wclock*"
   "Name of the `world-clock' buffer."
-  :group 'display-time
+  :group 'world-clock
   :type 'string
-  :version "23.1")
+  :version "28.1")
 
-(defcustom display-time-world-timer-enable t
+(defcustom world-clock-timer-enable t
   "If non-nil, a timer will update the `world-clock' buffer."
-  :group 'display-time
+  :group 'world-clock
   :type 'boolean
-  :version "23.1")
+  :version "28.1")
 
-(defcustom display-time-world-timer-second 60
+(defcustom world-clock-timer-second 60
   "Interval in seconds for updating the `world-clock' buffer."
-  :group 'display-time
+  :group 'world-clock
   :type 'integer
-  :version "23.1")
+  :version "28.1")
 
 ;;;###autoload
 (defun display-time ()
@@ -507,23 +510,48 @@ display-time-mode
     (remove-hook 'rmail-after-get-new-mail-hook
 		 'display-time-event-handler)))
 
-
-(defface display-time-world-label
+\f
+;;; 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")
+
+\f
+;;; World clock
+
+(defface world-clock-label
   '((t :inherit font-lock-variable-name-face))
   "Face for time zone label in `world-clock' buffer.")
 
-(defvar display-time-world-mode-map
+(defvar world-clock-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "g" #'display-time-world-timer)
+    (define-key map "g" #'world-clock-update)
     map)
-  "Keymap for `display-time-world-mode'.")
+  "Keymap for `world-clock-mode'.")
 
-(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 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)
@@ -535,7 +563,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)
@@ -544,7 +572,7 @@ 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)))
@@ -552,32 +580,30 @@ display-time-world-display
 ;;;###autoload
 (defun world-clock ()
   "Show world clock buffer with times in various time zones.
-`display-time-world-list' specifies the zones.
+`world-clock-list' specifies the zones.
 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))
-  (pop-to-buffer display-time-world-buffer-name)
-  (display-time-world-display (time--display-world-list))
-  (display-time-world-mode))
-
-(defun display-time-world-timer ()
+  (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))
+
+(defun world-clock-update ()
   "Update the `world-clock' buffer."
   (interactive)
-  (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)))
+  (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)))))))
 
-(defalias 'display-time-world #'world-clock)
-
 ;;;###autoload
 (defun emacs-uptime (&optional format)
   "Return a string giving the uptime of this instance of Emacs.
-- 
2.26.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Rearrange-and-cleanup-code-in-time.el-Bug-40863.patch --]
[-- Type: text/x-diff, Size: 12746 bytes --]

From 137c920f5b1ab34120060af0d4e3adada0f3a8a3 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sat, 2 May 2020 17:37:06 +0200
Subject: [PATCH 4/4] Rearrange and cleanup 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 | 216 +++++++++++++++++++++++----------------------------
 1 file changed, 97 insertions(+), 119 deletions(-)

diff --git a/lisp/time.el b/lisp/time.el
index 3f1880b708..e678254b54 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
-  "Show a world clock."
-  :group 'applications)
-
-(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.
@@ -236,7 +133,6 @@ display-time-mail-face
 background color is the background of this face.  Set this to
 make the mail indicator stand out on a color display."
   :group 'mode-line-faces
-  :group 'display-time
   :version "22.1"
   :type '(choice (const :tag "None" nil) face))
 
@@ -251,14 +147,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 +166,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 +220,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 +428,92 @@ 'display-time-world-timer
 \f
 ;;; World clock
 
+(defgroup world-clock nil
+  "Show a world clock."
+  :group 'applications)
+
+(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.26.2


  parent reply	other threads:[~2020-05-02 16:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26  8:56 bug#40863: [PATCH] Improve the display-time-world UI Stefan Kangas
2020-04-26 14:08 ` Eli Zaretskii
2020-04-26 14:19   ` Stefan Kangas
2020-04-27 17:20   ` Noam Postavsky
2020-04-27 18:31     ` Eli Zaretskii
2020-04-27 19:00       ` Noam Postavsky
2020-04-27 19:35         ` Eli Zaretskii
2020-04-27 22:00           ` Dmitry Gutov
2020-04-27 23:04             ` Noam Postavsky
2020-05-01 15:03         ` Stefan Kangas
2020-05-01 15:13           ` Eli Zaretskii
2020-05-01 16:26             ` Stefan Kangas
2020-05-01 17:57               ` Eli Zaretskii
2020-05-01 18:07                 ` Dmitry Gutov
2020-05-01 18:18                   ` Eli Zaretskii
2020-04-27 22:58 ` Basil L. Contovounesios
2020-05-02 11:50   ` Stefan Kangas
2020-05-23 13:44     ` Basil L. Contovounesios
2020-05-02 16:10   ` Stefan Kangas [this message]
2020-05-02 18:00     ` Stefan Kangas
2020-05-23 13:43     ` Basil L. Contovounesios
2020-08-07 17:23       ` Stefan Kangas
2020-08-07 17:51         ` Basil L. Contovounesios
2020-08-09 22:11           ` Stefan Kangas
2020-08-18 13:49             ` Lars Ingebrigtsen
2020-08-18 14:37               ` Stefan Kangas
2020-08-18 18:23                 ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k11u48t0.fsf@stefankangas.se \
    --to=stefan@marxist.se \
    --cc=40863@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.