From b84acc8c76128f7827ac7f5877bb992994770f9f Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sun, 19 Nov 2023 16:04:30 -0500 Subject: New function emacsconf-timezone-strings-combined That should make it easier to specify multiple timezones (comma-separated) and use those in e-mails --- emacsconf.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'emacsconf.el') diff --git a/emacsconf.el b/emacsconf.el index 9746308..d5e6c3d 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -1098,9 +1098,31 @@ The subheading should match `emacsconf-abstract-heading-regexp'." (format-time-string "%-l:%M %p %Z" end tz) tz)))) + (defun emacsconf-timezone-strings (o &optional timezones) (mapcar (lambda (tz) (emacsconf-timezone-string o tz)) (or timezones emacsconf-timezones))) +(defun emacsconf-timezone-strings-combined (time timezones &optional format) + "Show TIME in TIMEZONES. +If TIMEZONES is a string, split it by commas." + (let* ((format (or format "%b %-d %-l:%M %p")) + (base-time (format-time-string format time emacsconf-timezone)) + (timezones (if (stringp timezones) (split-string timezones " *, *" t)))) + (concat base-time " in " (emacsconf-schedule-rename-etc-timezone emacsconf-timezone) + (if timezones + (concat + " (which is " + (mapconcat + (lambda (tz) + (let ((translated-time (format-time-string format time tz))) + (if (string= translated-time base-time) + (concat "the same in " (emacsconf-schedule-rename-etc-timezone tz)) + (concat translated-time " in " (emacsconf-schedule-rename-etc-timezone tz))))) + timezones + "; ") + ")") + "")))) + ;;;###autoload (defun emacsconf-convert-from-timezone (timezone time) (interactive (list (progn -- cgit v1.2.3