GNU bug report logs - #79217
[PATCH] display-time-mode: Include world-clock time in mode line.

Previous Next

Package: emacs;

Reported by: Wilko Meyer <w <at> wmeyer.eu>

Date: Mon, 11 Aug 2025 14:01:01 UTC

Severity: normal

Tags: patch

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Wilko Meyer <w <at> wmeyer.eu>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] display-time-mode: Include world-clock time in mode line.
Date: Mon, 11 Aug 2025 16:00:15 +0200
[Message part 1 (text/plain, inline)]
Hi,

This patch introduces an user option to conditionally include
world-clock time, in addition to the localtime, when display-time-mode is
active, in mode line. Right now time in different timezones is only
available in a separate world-clock buffer, having this information
included in the mode line would be useful in my book. WDYT?

I'm not sure if I already have assigned copyright to the FSF before,
so I'll do that within the next hours as required.

[0001-display-time-mode-Add-option-to-show-world-clock-tim.patch (text/x-patch, inline)]
From ac5e6bb2be0c0636534be55a170b34dd8386ef5f Mon Sep 17 00:00:00 2001
From: Wilko Meyer <w <at> wmeyer.eu>
Date: Mon, 11 Aug 2025 15:34:07 +0200
Subject: [PATCH] display-time-mode: Include world-clock time in mode line.

* lisp/time.el (display-time-include-world-clock): Add user option.
(display-time-string-forms): Conditionally include world clock time.
---
 lisp/time.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lisp/time.el b/lisp/time.el
index 3750206d08e..f6da94d2e9a 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -177,6 +177,11 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'."
   :type '(choice (const :tag "Default" nil)
 		 string))
 
+(defcustom display-time-include-world-clock nil
+  "Non-nil means time from `world-clock-list', `zoneinfo-style-world-list'
+or `legacy-style-world-list' entries are displayed in mode line."
+  :type 'boolean)
+
 (defcustom display-time-string-forms
   '((if (and (not display-time-format) display-time-day-and-date)
 	(format-time-string "%a %b %e " now)
@@ -187,6 +192,18 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'."
 			 now)
      'face 'display-time-date-and-time
      'help-echo (format-time-string "%a %b %e, %Y" now))
+    (if display-time-include-world-clock
+        (mapconcat
+         (lambda (p)
+           (pcase-let ((`(,tz ,label) p))
+             (format " %s (%s)"
+                     (format-time-string
+                      (or display-time-format
+                          (if display-time-24hr-format "%H:%M" "%-I:%M%p"))
+                      now tz)
+                     label)))
+         (time--display-world-list))
+      "")
     load
     (if mail
 	;; Build the string every time to act on customization.
-- 
2.50.1

[Message part 3 (text/plain, inline)]
-- 
Kind regards,
Wilko Meyer

This bug report was last modified 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.